array_replace_recursive

It replaces elements from passed arrays into the first array recursively

Example

<?php
echo “<pre>”;
$array1 = array(‘WEB’ => array( “PHP”) , ‘ASP’ => array(“JAVA”, “JSP”), );
$array2 = array(‘JScript’ => array(‘VB’), ‘JS’ => array(‘C’));

$array2 = array_replace_recursive($array1, $array2);
print_r($array2);
?>

Output

Array
(
[WEB] => Array
(
[0] => PHP
)

[ASP] => Array
(
[0] => JAVA
[1] => JSP
)

[JScript] => Array
(
[0] => VB
)

[JS] => Array
(
[0] => C
)

)