I have two multidimensional arrays like:
[a]
[b]
[c]
and
[a]
[b]
[c]
[d]
and want to turn it into a single array
[a]
[b]
[c]
[d]
I tried the array_merge_recursive() function, but it creates new elements on the last level instead of overwriting them.
For example, if [c] is "X" in the first array, and "Y" in the second array, I get array("X", "Y") instead of the last value ("Y").
Is this what you’re after, using
array_replace_recursive?Outputs:
http://www.php.net/manual/en/function.array-replace-recursive.php