PHP array_replace_recursive() Function

The array_replace_recursive() function replaces the values of the first array with the values from following arrays recursively.

Tip: You can assign one array to the function, or as many as you like.

Note: If you do not specify a key for each array, this function will behave exactly the same as the array_replace() function.

Parameter Description
array1 Required. Specifies an array
array2 Optional. Specifies an array which will replace the values of array1
array3,… Optional. Specifies more arrays to replace the values of array1 and array2, etc. Values from later arrays will overwrite the previous ones.






Array ( [a] => Array ( [0] => Alex ) [b] => Array ( [0] => Cooper [1] => Lachlan ) ) 

Leave a Reply

Your email address will not be published. Required fields are marked *