Exemplo n.º 1
0
 function _complexMerge($arr1, $arr2, $opt)
 {
     $r = (array) $arr1;
     foreach ((array) $arr2 as $key => $val) {
         if ($opt['sequences'] === 'first' && is_int($key)) {
             $r[] = $val;
         } elseif ($opt['curDepth'] < $opt['depth'] && is_array($val) && isset($r[$key]) && is_array($r[$key])) {
             $subOpt = $opt;
             $subOpt['curDepth']++;
             $r[$key] = SetMulti::_complexMerge($r[$key], $val, $subOpt);
         } elseif ($opt['sequences'] && is_int($key)) {
             $r[] = $val;
         } else {
             $r[$key] = $val;
         }
     }
     return $r;
 }