PHP Programing language

array_merge() Function in PHP
Previous Home Next
adplus-dvertising

array_merge()

The array_merge() function merges or combine one or more arrays into another array.

Syntax:
array_merge(array1,array2,array3...)

In above syntax,"array1" specifies an array, "array2" specifies an array and "array3,..." specifies an array

Example:

<?php
$array1=array("Apple","Banana");
$array2=array("Orange","Mango");
print_r(array_merge($array1,$array2));
?>

Output:

Array ( [0] => Apple [1] => Banana [2] => Orange [3] => Mango )

Previous Home Next