PHP array_replace_recursive() Function

The PHP array_replace_recursive() function is used to replace the values of the first array with the values from following arrays recursively.array_replace_recursive() replaces the values of array1 with the same values from all the following arrays. If a key from the first array exists in the second array, its value will be replaced by the value from the second array. If the key exists in the second array, and not the first, it will be created in the first array. If a key only exists in the first array, it will be left as is. If several arrays are passed for replacement, they will be processed in order, the later array overwriting the previous values.

Example -

Example -