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 ) )
PHP Version:

Example #2 array_replace_recursive and recursive behavior

Result: Array ( [citrus] => Array ( [0] => pineapple ) [berries] => Array ( [0] => blueberry [1] => raspberry ) [others] => litchis )
PHP Version:


Example #3 of array_replace_recursive

PHP Version:


Function array_replace_recursive:

Arrays Functions

Most used PHP functions