Home > Article > Backend Development > How to include other arrays in an array in php?
<code> $name1=$_POST['name']; $hobbyS1=array(); $hobbyS1=$_POST['hobbyS']; $sre1=$_POST['sre']; $fields = array($name1,$sre1); echo implode($fields);</code>
As shown in the above code, it displays normally.
I want to put the array hobbyS1 into $fields. How can I achieve this?
This is what I do
$fields = array($name1,$sre1,$hobbyS1);
No,
how should I put it? Thank you
<code> $name1=$_POST['name']; $hobbyS1=array(); $hobbyS1=$_POST['hobbyS']; $sre1=$_POST['sre']; $fields = array($name1,$sre1); echo implode($fields);</code>
As shown in the above code, it displays normally.
I want to put the array hobbyS1 into $fields. How can I achieve this?
This is what I do
$fields = array($name1,$sre1,$hobbyS1);
No,
how should I put it? Thank you
<code>var_dump($_POST) 看下有没有值,正常是可以的 </code>
$fileds = array($name1, $sre1); can be used after
<code>array_push($fileds, $hobbyS1); OR $fields[] = $hobbyS1 </code>
After execution:
<code>$fields = array($name,$sre1);</code>
Use:
<code>$fields[] = $hobbyS1; </code>
I tried it and it works