得到一列.
@param array $array 数组.
@param string $name 名称.
@param bool $keepKeys 保留键名.
@return array
968657
public static function getColumn(
        array $array,
        string $name,
        bool $keepKeys = true
    ): array {
        $result = [];
        if ($keepKeys) {
            foreach ($array as $k => $element) {
                $result[$k] = static::get($element, $name);
            }
        } else {
            foreach ($array as $element) {
                $result[] = static::get($element, $name);
            }
        }
        return $result;
    }
646770
public static function filterKeys($array, $keys, $remove = false)
	{
		$return = array();
		foreach ($keys as $key)
		{
			if (array_key_exists($key, $array))
			{
				$remove or $return[$key] = $array[$key];
				if ($remove)
				{
					unset($array[$key]);
				}
			}
		}
		return $remove ? $array : $return;
	}
37437
private function findKey(string $name, array $keys)
    {
        // 1 level keys > optimization
        if (sizeof($keys) == 1) {
            if (isset($this->translations[$name][$keys[0]])) {
                return $this->translations[$name][$keys[0]];
            } else {
                return null;
            }
        }

        $ref = &$this->translations[$name];
        $leave = false;

        while ($leave == false) {
            $key = array_shift($keys);

            if (is_null($key)) {
                $leave = true;
            } else {
                $ref = &$ref[$key];
            }
        }

        return $ref;
    }
573902
public static function find(array $data, callable $callback = null, $keepKey = false, $offset = null, $limit = null)
    {
        $results = [];
        $i = 0;
        $c = 0;

        $callback = null === $callback ? 'is_null' : $callback;

        foreach ($data as $key => $value) {
            // If use global function, send only value as argument.
            if (is_string($callback)) {
                $r = $callback($value);
            } else {
                $r = $callback($value, $key);
            }

            if ($r) {
                if ($offset !== null && $offset > $i) {
                    continue;
                }

                if ($limit !== null && $c >= $limit) {
                    break;
                }

                $results[$key] = $value;
                $c++;
            }

            $i++;
        }

        return $keepKey ? $results : array_values($results);
    }
381874
public static function deleteKeys(array &$array, array $unwantedKey)
    {
        self::unsetKeys($array, $unwantedKey);

        foreach ($array as &$value) {
            if (\is_array($value)) {
                self::deleteKeys($value, $unwantedKey);
            }
        }
    }
462127
public static function columnToKey($array, $column, $keepOld = true)
    {
        $newArray = [];
        foreach($array as $k => $row)
        {
            $key = $row[$column];
            if(!$keepOld)
            {
                unset($row[$column]);
            }
            $newArray[$key] = $row;
        }
        return $newArray;
    }
534859
public static function lists($array, $key)
    {
        $result = [];
        foreach ($array as $element) {
            $value = static::get($element, $key);
            $result[$value] = $element;
        }

        return $result;
    }
1363717
public static function groupElementsByValueKeys($array, $groupKeys) {

        if (!is_array($groupKeys)) {
            $groupKeys = array($groupKeys);
        }

        $newArray = new AssociativeArray();
        foreach ($array as $element) {

            $applyObject = $newArray;
            foreach ($groupKeys as $index => $groupKey) {
                if ($index < sizeof($groupKeys) - 1) {
                    $subArray = $applyObject[$element[$groupKeys[$index]]];
                    if (!$subArray) {
                        $subArray = new AssociativeArray();
                        $applyObject[$element[$groupKeys[$index]]] = $subArray;
                    }
                    $applyObject = $subArray;
                } else {
                    if (!is_array($applyObject[$element[$groupKeys[$index]]])) {
                        $applyObject[$element[$groupKeys[$index]]] = array();
                    }
                    $applyObject[$element[$groupKeys[$index]]][] = $element;

                }
            }

        }

        
        return $newArray->toArray();
    }
573117
public function intersection(array $search, bool $keepKeys = false): self
    {
        if ($keepKeys) {
            return static::create(
                \array_uintersect(
                    $this->array,
                    $search,
                    static function ($a, $b) {
                        return $a === $b ? 0 : -1;
                    }
                ),
                $this->iteratorClass,
                false
            );
        }

        return static::create(
            \array_values(\array_intersect($this->getArray(), $search)),
            $this->iteratorClass,
            false
        );
    }
1104252
public static function has($array, $keys)
	{
		if(is_null($keys) || !$array)
			return false;

		$keys = static::toArray($keys);

		if($keys === [])
			return false;

		foreach ($keys as $key) {
			$subKeyArray = $array;

			if (static::exists($array, $key))
				continue;

			foreach (static::toKey($key) as $segment) {
				if (static::accessible($subKeyArray) && static::exists($subKeyArray, $segment))
					$subKeyArray = $subKeyArray[$segment];
				else
					return false;
			}
		}

		return true;
	}
146354
public function array_map( $array, $callback ) {
		$array = $this->get_array_value( $array );

		return array_map( function ( $d ) use ( $callback ) {
			return is_callable( $callback ) ? $callback( $d ) : ( is_string( $callback ) && method_exists( $d, $callback ) ? $d->$callback() : null );
		}, $array );
	}
938482
public function keyExists($key, $array)
    {
        if (array_key_exists($key, $array)) {
            return true;
        }

        foreach ($array as $k => $value) {
            if (!is_array($value)) {
                continue;
            }

            if (array_key_exists($key, $value)) {
                return true;
            }
        }

        return false;
    }
424594
public static function extractKeys($array, $keys) {
		$result = [ ];
		foreach ( $keys as $key ) {
			if (isset ( $array [$key] )) {
				$result [$key] = $array [$key];
			}
		}
		return $result;
	}
1188674
public static function arrayOnlyWith(array $array, array $keys)
    {
        $result = array();

        if (!self::isSequential($array)) {
            foreach ($array as $key => $value) {
                if (in_array($key, $keys)) {
                    $result[$key] = $value;
                }
            }
        } else {
            foreach ($array as $value) {
                if (in_array($value, $keys)) {
                    $result[] = $value;
                }
            }
        }

        return $result;
    }
292395
public static function array_keys_exists(array $keys,array $array )
    {
        //键不是数组直接返回false
        if (!is_array($keys)) {
            return false;
        }
        foreach ($keys as $k) {
            if (!isset($array[$k])) {
                return false;
            }
        }
        return true;
    }
1153113
protected function getOnlyStringKeys(array $array)
    {
        $allowed = array_filter(array_keys($array), function ($key)
        {
            return ! is_int($key);
        });

        return array_intersect_key($array, array_flip($allowed));
    }
1262398
public static function array_copy($array)
    {
        if (!is_array($array)) {
            return $array;
        }

        $result = array();
        foreach ($array as $key => $val) {
            if (is_array($val)) {
                $result[$key] = self::array_copy($val);
            } elseif (is_object($val)) {
                $result[$key] = clone $val;
            } else {
                $result[$key] = $val;
            }
        }
        return $result;
    }