PHP Programing language

array_merge_recursive() Function in PHP
Previous Home Next

array_merge_recursive()

The array_merge_recursive() function merges one ore more arrays into one array. The array_merge_recursive() function is differ from the array_merge() function is when two or more array elements have the same key. The array_merge_recursive() function makes the value as an array, instead of override the keys.

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

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

Example:

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

Output:

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

Previous Home Next

Tolal:0 Click:

Show All Comments

Did not find what you were looking for leave your name and message. We will revert within 24 hours
Name:
eMail:
Comment / Feedback: