Check if a value exists in an array

@param array $array The array
@param mixed $value The value to look for

@return bool
331220
public static function existsValue($array, $value)
    {
        if (!self::isValid($array)) {
            return false;
        }

        $returnValue = false;
        $length = self::length($array);

        for ($i = 0; $i < $length; $i++) {
            if ($value === $array[$i]) {
                $returnValue = true;
                break;
            }
        }

        return $returnValue;
    }
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;
    }
458057
public static function keyExists(array $array, $path) : bool
    {
        foreach (explode('.', $path) as $segment) {
            if (! is_array($array) or ! array_key_exists($segment, $array)) {
                return false;
            }

            $array = $array[$segment];
        }

        return true;
    }
942779
public static function keysExist ($array, $keys)
		{
			if (!is_array($array))
				return null;

			if (!is_array($keys))
				$keys = [ $keys ];

			foreach ($keys as $key)
				if (!array_key_exists($key, $array))
					return false;

			return true;
		}
288169
public static function fillMissingKeys(array $array, $value = '')
    {
        if (count($array) === 0 || self::isAssociativeArray($array) === true) {
            return $array;
        }

        // sort and reset pointer to first element
        ksort($array);
        $min = key($array);
        end($array);
        $max = key($array);

        for ($i = $min; $i < $max; ++$i) {
            if (array_key_exists($i, $array) === false) {
                $array[$i] = $value;
            }
        }

        ksort($array);

        return $array;
    }
400964
protected function isExists(array $value)
    {

        // validate fields by exist in tables

        foreach ($value as $table => $fields) {

            // load model metaData

            if ($this->isModel($table) === true) {
                $model = (new Manager())->load($table, new $table);

                // check fields of table

                $this->validColumns($model->getModelsMetaData(), $fields, $table, $model);

                // setup clear used tables
                $columnDefines = (new $table)->getReadConnection()->describeColumns($model->getSource());

                // add using tables with model alias
                $this->fields['tables'][$model->getSource()] = $table;

                // checking columns & fields

                foreach ($columnDefines as $column) {

                    if (in_array($column->getName(), $fields) === true) {
                        $this->validTypes($column);

                        // add column to table collection
                        $this->fields[$this->cast][$model->getSource()][$column->getName()] = $column->getType();
                    }
                }
            }
        }

        return true;
    }
22402
public static <T> boolean contains(T[] array, T value) {
		return indexOf(array, value) > INDEX_NOT_FOUND;
	}
1110567
public static function containsMultipleTypes(array $array): bool
    {
        if (count($array) > 0) {
            reset($array);
            $previousType = gettype(current($array));
            next($array);
            foreach ($array as $value) {
                if ($previousType !== gettype($value)) {
                    return true;
                }
            }
        }
        return false;
    }
1362514
protected function hasValue($value)
    {
        $value = (int) $value;

        return isset(static::$names[$value]) || array_key_exists($value, static::$names);
    }
981360
public static function has($array, $keys): bool
    {
        if (null === $keys) {
            return false;
        }

        $keys = (array)$keys;

        if (!$array) {
            return false;
        }

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

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

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

            foreach (explode('.', $key) as $segment) {
                if (static::accessible($subKeyArray) && static::exists($subKeyArray, $segment)) {
                    $subKeyArray = $subKeyArray[$segment];
                } else {

                    return false;
                }
            }
        }

        return true;
    }
877782
public static function indexOf(array $array, string $value, ?string $key = null)
    {
        foreach ($array as $index => $item) {
            if ($key !== null) {
                if (is_object($item)) {
                    $checkValue = isset($item->{$key}) ? $item->{$key} : null;
                } else {
                    $checkValue = isset($item[$key]) ? $item[$key] : null;
                }
            } else {
                $checkValue = $item;
            }
            if ($checkValue !== null && $checkValue === $value) {
                return $index;
            }
        }
        return -1;
    }
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;
    }
409768
public static function exists(array $array, $key)
    {
        //
        if (array_key_exists($key, $array)) {
            return true;
        }
        //
        $keys = dot($key);
        //
        foreach ($keys as $key) {
            if (array_key_exists($key, $array)) {
                $array = (array) $array[$key];
                continue;
            } else {
                return false;
            }
        }
        //
        return true;
    }
1252040
public static function isList(array $array): bool
	{
		$count = count($array);

		$range = $count
			? range(0, $count - 1)
			: [];

		$keys = array_keys($array);

		return $keys === $range;
	}
585438
public function addAllArray(array $array): bool {
        $added = true;
        foreach ($array as $value) {
            $added &= $this->add($value);
        }
        return $added;
    }
967293
public function hasLinks($array) {
        if(is_array($array)) {
            foreach($array as $link) {
                if($this->hasLink($link) === false) {
                    return false;
                }
            }
            return true;
        }
        return false;
    }
1260896
public static function is_associative (array $array)
		{
			foreach ($array as $k => $v)
			{
				$t = str_replace((int)$k, '', $k);
				if (!empty($t))
				{
					if (!static::is_int($k))
					{
						return true;
					}
				}
			}

			return false;
		}