Advertisement
Guest User

Untitled

a guest
Feb 5th, 2016
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. function ex_arr_replace_recursive(&$arr, &$arr2) {
  2. $cb = function (&$arr, &$arr2) use (&$cb) {
  3. foreach ($arr2 as $key => &$value) {
  4. if (is_array($value)) {
  5. if (!isset($arr[$key]) or !is_array($arr[$key])) {
  6. $arr[$key] = $value;
  7. } else {
  8. $cb($arr[$key], $arr2[$key]);
  9. }
  10. } else {
  11. $arr[$key] = $value;
  12. }
  13. }
  14. };
  15.  
  16. $cb($arr, $arr2);
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement