replace ArrayUtils with native array_replace_recursive call