合并多个二维数组 如果键名相同后面的数组会覆盖前面的数组
@param array $arr
@param array ...
@return array
341555
public static function merge2D(array $arr) {
		$args = func_get_args();
		$results = call_user_func_array('array_merge', $args);
		foreach ($results as $key => $value) {
			$temps = array();
			foreach ($args as $val) {
				$temps[] = isset($val[$key]) ? (array)$val[$key] : array();
			}
			$results[$key] = call_user_func_array('array_merge', $temps);
		}
		return $results;
	}
1348642
public function arrMapParse(&$arr){
        $temp = [];
        foreach ($arr as $k => $v){
            $temp[$this->arrMapGetName($k)] = $v;
        }
        return $temp;
    }
398358
public static function rearrangePostedFiles($arr)
    {
        $new = array();
        foreach ($arr as $key => $all) {
            if (is_array($all)) {
                foreach ($all as $i => $val) {
                    $new[$i][$key] = $val;
                }
            } else {
                $new[0][$key] = $all;
            }
        }

        return $new;
    }
536773
protected static function get_instances($arr) {
        $result = array();
        foreach ($arr as $key => $sub) {
            $result[$key] = new rule($sub);
        }
        return $result;
    }
1028113
public function fromArray(array $arr)
    {
        foreach ($arr as $key => $value) {
            $method = 'set' . $key;
            if (method_exists($this, $method)) {
                $this->$method($value);
            }
        }
    }
62523
protected static function deleteMultiple(array &$arr, array $keys)
    {
        $return = [];
        foreach ($keys as $key) {
            $return[$key] = static::delete($arr, $key);
        }

        return $return;
    }
605197
private static function sort_multi(& $arr, array $args)
    {
        $sortArray = [];
        $sortRule = '';
        foreach ($args as $sortField => $sortDir) {
            foreach ($arr as $offset => $row) {
                $sortArray[$sortField][$offset] = $row[$sortField];
            }
            $sortRule .= '$sortArray[\'' . $sortField . '\'], ' . $sortDir . ', ';
        }
        if (empty($sortArray) || empty($sortRule)) {
            return $arr;
        }
        eval('array_multisort(' . $sortRule . '$arr);'); //引用传值
        return $arr;
    }
197398
public static function mergeTree(array $arr1, array $arr2): array
	{
		$res = $arr1 + $arr2;
		foreach (array_intersect_key($arr1, $arr2) as $k => $v) {
			if (is_array($v) && is_array($arr2[$k])) {
				$res[$k] = self::mergeTree($v, $arr2[$k]);
			}
		}
		return $res;
	}
213062
public function customize(array $arr): array
  {
    $res = [];
    if ( isset($arr[0]) ){
      foreach ( $arr as $a ){
        if ( isset($a['id']) && $this->has($a['id']) ){
          $res[] = $a;
        }
      }
    }
    else if ( isset($arr['items']) ){
      $res = $arr;
      unset($res['items']);
      foreach ( $arr['items'] as $a ){
        if ( isset($a['id']) && $this->has($a['id']) ){
          if ( !isset($res['items']) ){
            $res['items'] = [];
          }
          $res['items'][] = $a;
        }
      }
    }
    return $res;
  }
205186
private function unflatten(array $arr)
  {
    $result = array();
    foreach ($arr as $key => $val) {
      if (strpos($key, '.') !== false) {
        parse_str('result[' . str_replace('.', '][', $key) . ']=' . $val);
      } else {
        $result[$key] = $val;
      }
    }
    return $result;
  }
282510
protected static function export(array $arr)
	{
		$exportKeys = (array_keys($arr) !== range(0, count($arr) - 1));
		ksort($arr);

		$entries = [];
		foreach ($arr as $k => $v)
		{
			$entries[] = (($exportKeys) ? var_export($k, true) . '=>' : '')
			           . ((is_array($v)) ? self::export($v) : var_export($v, true));
		}

		return '[' . implode(',', $entries) . ']';
	}
464673
protected static function mergeSettings($Arr1, $Arr2)
    {
        foreach ($Arr2 as $key => $Value) {
            if (array_key_exists($key, $Arr1) && is_array($Value)) {
                $Arr1[$key] = self::mergeSettings($Arr1[$key], $Arr2[$key]);
            } else {
                $Arr1[$key] = $Value;
            }
        }
        return $Arr1;
    }
121514
public static function remove_empty($arr)
    {
        if (empty($arr)) {
            return null;
        }
        foreach ($arr as $key => $value) {
            if (is_array($value)) {
                $arr[$key] = self::remove_empty($value);
            } else {
                if (empty($value)) {
                    unset($arr[$key]);
                } else {
                    $arr[$key] = $value;
                }
            }
        }
        return $arr;
    }
1317715
public static function Deserialize($arr){
		if(is_null($arr))
			return null;
		$res=Array();
		$i=-1;
		$len=sizeof($arr);
		while(++$i<$len)
			$res[$arr[$i]->Key]=$arr[$i]->Value;
		return $res;
	}
1173464
public function merge($arr = [])
    {
        $newData = array_merge($this->toArray(), $arr);
        return $this->reset($newData);
    }
1160041
public static function from_array($arr)
    {
        $obj = new rcube_message_header;
        foreach ($arr as $k => $v)
            $obj->set($k, $v);

        return $obj;
    }
642651
private static function getDominant($arr) {
    $score = array(
      'ARABIC'     => 0,
      'ARMENIAN'   => 0,
      'BENGALI'    => 0,
      'BURMESE'    => 0,
      'CJK'        => 0,
      'CYRILLIC'   => 0,
      'DEVANAGARI' => 0,
      'GEORGIAN'   => 0,
      'GREEK'      => 0,
      'GUJARATI'   => 0,
      'HEBREW'     => 0,
      'JAPANESE'   => 0,
      'KHMER'      => 0,
      'KOREAN'     => 0,
      'LAO'        => 0,
      'LATIN'      => 0,
      'MALAYALAM'  => 0,
      'SINHALA'    => 0,
      'TAMIL'      => 0,
      'THAI'       => 0,
      'TIBETAN'    => 0,
      'OTHER'      => 0,
    );
    foreach ($arr as $n) {
      $type = self::ord2charset($n);
      $score[$type]++;
    }
    $score = array_filter($score);
    arsort($score);
    $score = array_keys($score);
    if ($score[0] == 'CJK' && isset($score[1]) && $score[1] == 'JAPANESE') {
      return 'JAPANESE';
    }
    return $score[0];
  }