Answer the question
In order to leave comments, you need to log in
How to recursively replace value 1 of array value with another one?
I have 2 arrays - they are identical in structure. like
Array
(
[1] => Array
(
[0] => 123
[1] => 412412
[2] => 21424124
)
)
and there is 2 array
Array(
[32] => Array
(
[7] => 4124124
[8] => 124124
[9] => 124124
)
This is just a small piece of the array, in fact there are about 50 values in array 1 and array 2.
Tree-wise they are completely identical - the only difference is that they have different keys .
How can I replace the value of the 1st array (value2) with the second array without touching the keys? I tried
array_merge and array_merge_recursive as well as replace didn't help either, can anyone advise me if there is any simple solution for such a task?
Answer the question
In order to leave comments, you need to log in
array_combine(array_keys($arr1), array_values($arr2));
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question