"polyfills" for array_replace and *_recursive

array_replace_recursive and array_replace backoported for old PHP
versions