php add array to array
php add array to array
1 Answer
If you have two arrays and you want to combine them into a single array
using array_merge( array1, array2 ,array3 ...) function
this function will return the array
Example
<?php
echo'<pre>';
$array1 = [1,2,3];
$array2 = ['a','b','c'];
$array3 = ['d','e','f'];
$array4 = array_merge($array1,$array2,$array3);
print_r($array4);
echo'</pre>';
?>
output
Array ( [0] => 1 [1] => 2 [2] => 3 [3] => a [4] => b [5] => c [6] => d [7] => e [8] => f )
answer Link