Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function ex_arr_replace_recursive(&$arr, &$arr2) {
- $cb = function (&$arr, &$arr2) use (&$cb) {
- foreach ($arr2 as $key => &$value) {
- if (is_array($value)) {
- if (!isset($arr[$key]) or !is_array($arr[$key])) {
- $arr[$key] = $value;
- } else {
- $cb($arr[$key], $arr2[$key]);
- }
- } else {
- $arr[$key] = $value;
- }
- }
- };
- $cb($arr, $arr2);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement