Share on Google+Share on Google+

PHP Array Merge

Advertisement
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

Advertisements

Posted on: October 28, 2009 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.