Replace the values of the first array with the values from the second array recursively in PHP
Description
The following code shows how to replace the values of the first array with the values from the second array recursively.
Example
//ww w. j a v a2s . c o m
<?php
$a1=array("a"=>array("red"),"b"=>array("green","blue"),);
$a2=array("a"=>array("yellow"),"b"=>array("black"));
print_r(array_replace_recursive($a1,$a2));
?>
The code above generates the following result.