array_replace_recursive
PHP 5 >= 5.3.0, PHP 7, PHP 8
array_replace_recursive - Replaces elements from passed arrays into the first array recursively
Example #1 array_replace_recursive example
Result: Array
(
[citrus] => Array
(
[0] => pineapple
)
[berries] => Array
(
[0] => blueberry
[1] => raspberry
)
)
Array
(
[citrus] => Array
(
[0] => pineapple
)
[berries] => Array
(
[0] => blueberry
)
)
Example #2 array_replace_recursive and recursive behavior
Result: Array
(
[citrus] => Array
(
[0] => pineapple
)
[berries] => Array
(
[0] => blueberry
[1] => raspberry
)
[others] => litchis
)
Example #3 of array_replace_recursive