original_string: public static function merge_arrays(array $a1, array $a2){
      $args = \func_get_args();
      if ( \count($args) > 2 ){
        for ( $i = \count($args) - 1; $i > 1; $i-- ){
          $args[$i-1] = self::merge_arrays($args[$i-1], $args[$i]);
        }
        $a2 = $args[1];
      }
      if ( (self::is_assoc($a1) || empty($a1)) && (self::is_assoc($a2) || empty($a2)) ){
        $keys = array_unique(array_merge(array_keys($a1), array_keys($a2)));
        $r = [];
        foreach ( $keys as $k ){
          if ( !array_key_exists($k, $a1) && !array_key_exists($k, $a2) ){
            continue;
          }
          else if ( !array_key_exists($k, $a2) ){
            $r[$k] = $a1[$k];
          }
          else if ( !array_key_exists($k, $a1) || !\is_array($a2[$k]) || !\is_array($a1[$k]) || is_numeric(key($a2[$k])) ){
            $r[$k] = $a2[$k];
          }
          else{
            $r[$k] = self::merge_arrays($a1[$k], $a2[$k]);
          }
        }
      }
      else{
        $r = array_merge($a1, $a2);
      }
      return $r;
    }
code: public static function merge_arrays(array $a1, array $a2){
      $args = \func_get_args();
      if ( \count($args) > 2 ){
        for ( $i = \count($args) - 1; $i > 1; $i-- ){
          $args[$i-1] = self::merge_arrays($args[$i-1], $args[$i]);
        }
        $a2 = $args[1];
      }
      if ( (self::is_assoc($a1) || empty($a1)) && (self::is_assoc($a2) || empty($a2)) ){
        $keys = array_unique(array_merge(array_keys($a1), array_keys($a2)));
        $r = [];
        foreach ( $keys as $k ){
          if ( !array_key_exists($k, $a1) && !array_key_exists($k, $a2) ){
            continue;
          }
          else if ( !array_key_exists($k, $a2) ){
            $r[$k] = $a1[$k];
          }
          else if ( !array_key_exists($k, $a1) || !\is_array($a2[$k]) || !\is_array($a1[$k]) || is_numeric(key($a2[$k])) ){
            $r[$k] = $a2[$k];
          }
          else{
            $r[$k] = self::merge_arrays($a1[$k], $a2[$k]);
          }
        }
      }
      else{
        $r = array_merge($a1, $a2);
      }
      return $r;
    }
code_tokens: public static function merge_arrays ( array $ a1 , array $ a2 ) { $ args = \ func_get_args ( ) ; if ( \ count ( $ args ) > 2 ) { for ( $ i = \ count ( $ args ) - 1 ; $ i > 1 ; $ i -- ) { $ args [ $ i - 1 ] = self :: merge_arrays ( $ args [ $ i - 1 ] , $ args [ $ i ] ) ; } $ a2 = $ args [ 1 ] ; } if ( ( self :: is_assoc ( $ a1 ) || empty ( $ a1 ) ) && ( self :: is_assoc ( $ a2 ) || empty ( $ a2 ) ) ) { $ keys = array_unique ( array_merge ( array_keys ( $ a1 ) , array_keys ( $ a2 ) ) ) ; $ r = [ ] ; foreach ( $ keys as $ k ) { if ( ! array_key_exists ( $ k , $ a1 ) && ! array_key_exists ( $ k , $ a2 ) ) { continue ; } else if ( ! array_key_exists ( $ k , $ a2 ) ) { $ r [ $ k ] = $ a1 [ $ k ] ; } else if ( ! array_key_exists ( $ k , $ a1 ) || ! \ is_array ( $ a2 [ $ k ] ) || ! \ is_array ( $ a1 [ $ k ] ) || is_numeric ( key ( $ a2 [ $ k ] ) ) ) { $ r [ $ k ] = $ a2 [ $ k ] ; } else { $ r [ $ k ] = self :: merge_arrays ( $ a1 [ $ k ] , $ a2 [ $ k ] ) ; } } } else { $ r = array_merge ( $ a1 , $ a2 ) ; } return $ r ; }
docstring: Returns to a merged array from two or more arrays.
  
  ```php
  \bbn\x::merge_arrays([1, 'Test'], [2, 'Example']);
  // array [1, 'Test', 2, 'Example']
  ```
  
  @param array $a1 The first array to merge.
  @param array $a2 The second array to merge.
  @return array The merged array.
docstring_tokens: Returns to a merged array from two or more arrays .