I think it is worth mentioning that the array passed as the first argument is not modified and is left intact. A new array is returned. I think the wording of this documentation could be improved because it suggests that the passed array *is* modified.
If you want to modify your existing array, it is not enough to do:
array_replace($arrayToModify, $arrayWithModifications);
You have to assign the returned value back to it like so:
$arrayToModify = array_replace($arrayToModify, $arrayWithModifications);