How can I do a deep extension of a multi dimensional associative array (for use with decoded JSON objects). I need the php equivalent of jQuery\'s $.extend(true, array1, arr
Taken from array_merge docs:
function array_extend($a, $b) { foreach($b as $k=>$v) { if( is_array($v) ) { if( !isset($a[$k]) ) { $a[$k] = $v; } else { $a[$k] = array_extend($a[$k], $v); } } else { $a[$k] = $v; } } return $a; }