Sunday, 22 June 2014

PHP Merge Two Array In PHP Into Single One

The “array_merge” function provides the easiest way to merge a list of arrays. It can take as much parameters as you give to it and it will merge all of them into a single one and return back to you. Example usage:
1
2
3
4
5
$myarray1 = array(1,2,3);
$myarray2 = array(4,5,6);
$myarray3 = array(7,8,9);
$single_merged_array = array_merge($array1,$array2,$array3);
print_r($single_merged_array);

No comments:

Post a Comment