PHP Array Merge


 

PHP Array Merge

This section we illustrates how to merge the array in php

This section we illustrates how to merge the array in php

  • In php two or more arrays can be added into a single array
  • It is done by the use of array_merge() function


Example of PHP Array Merge Function

<?php
$array1
=array(1,2,3);
$array2
=array(4,5,6);
$array3
=array_merge($array1,$array2);
foreach
($array3 as $a3)
echo
" ".$a3;?>

Output
1 2 3 4 5 6

Ads