1
For study purposes and better understanding I am trying to make an array within another array by adding values using the push array_follow my example:
<?php
$ar1 = array();
array_push($ar1, 1, 2, 3, 4);
foreach($ar1 as $ar) {
$ar2 = array();
array_push($ar2, 5, 6, 7, 8);
array_push($ar1, $ar2);
foreach($ar1 as $ar) {
echo $ar . "";
}
}
Notice: Array to string Conversion in D: Estudophp arrays.php on line 12 Array1234
As far as I’m concerned, I don’t understand the correct logic for this.
echo $ar . "";
is to mix array with string..., dovar_dump($ar);
instead of thisecho
– Sergio