How to merge two arrays in PHP?
You can merge two arrays into one array using the array_merge function.
The sample code is as follows:
$array1 = [1, 2, 3];
$array2 = [4, 5, 6];
$result = array_merge($array1, $array2);
print_r($result);
The output results are:
Array
(
[0] => 1
[1] => 2
[2] => 3
[3] => 4
[4] => 5
[5] => 6
)