An array is a special variable, which can hold more than one value at a time.
Let’s see the code example for merging two array in third empty array without using PHP in-built function.
<?php
$array_a = ['1','2','3'];
$array_b = ['4','5','6'];
$array_c = array();
for($i=0;$i<count($array_a); $i++ ){
$array_c[$i] = $array_a[$i];
}
$count = count($array_a);
for($i=($count),$j=0;$i<count($array_b)+$count; $i++,$j++){
$array_c[$i] = $array_b[$j];
}
print_r($array_c);
Output :
Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 [4] => 5 [5] => 6 )