Replace the values of the first array with the values from the second array recursively:


SUBMITTED BY: henry1874w

DATE: June 25, 2017, 2:44 p.m.

FORMAT: Text only

SIZE: 166 Bytes

HITS: 216

  1. <?php
  2. $a1=array("a"=>array("red"),"b"=>array("green","blue"),);
  3. $a2=array("a"=>array("yellow"),"b"=>array("black"));
  4. print_r(array_replace_recursive($a1,$a2));
  5. ?>

comments powered by Disqus