array_key_exists

Supported Versions: PHP 4 >= 4.0.7, PHP 5, PHP 7, PHP 8
Checks if the given key or index exists in the array
Alias key_exists
array_key_exists(string|int $key, array $array): bool
    public function hasCommandHandler($command)

    {

        return 
array_key_exists(get_class($command), $this->handlers);

    }
    public function forget($key)

    {

        if (
array_key_exists($key$this->storage)) {

            unset(
$this->storage[$key]);



            return 
true;
            $key = (string) $key;

        }



        return 
array_key_exists($key$array);

    }
    public function get($key$default null)

    {

        if (
array_key_exists($key$this->items)) {

            return 
$this->items[$key];

        }
    public function getOrPut($key$value)

    {

        if (
array_key_exists($key$this->items)) {

            return 
$this->items[$key];

        }
                    default => $groupKey,

                };



                if (! 
array_key_exists($groupKey$results)) {

                    
$results[$groupKey] = new static;

                }
        $keys is_array($key) ? $key func_get_args();



        foreach (
$keys as $value) {

            if (! 
array_key_exists($value$this->items)) {

                return 
false;

            }

        }
        return new static(function () use ($iterator, &$iteratorIndex, &$cache) {

            for (
$index 0true$index++) {

                if (
array_key_exists($index$cache)) {

                    yield 
$cache[$index][0] => $cache[$index][1];



                    continue;
        $count count($keys);



        foreach (
$this as $key => $value) {

            if (
array_key_exists($key$keys) && --$count == 0) {

                return 
true;

            }

        }
        $keys array_flip(is_array($key) ? $key func_get_args());



        foreach (
$this as $key => $value) {

            if (
array_key_exists($key$keys)) {

                return 
true;

            }

        }
                $keys array_flip($keys);



                foreach (
$this as $key => $value) {

                    if (
array_key_exists($key$keys)) {

                        yield 
$key => $value;



                        unset(
$keys[$key]);
            $items $this->getArrayableItems($items);



            foreach (
$this as $key => $value) {

                if (
array_key_exists($key$items)) {

                    yield 
$key => $items[$key];



                    unset(
$items[$key]);
    protected static function addDependencyForCallParameter($container$parameter,

                                                            array &
$parameters, &$dependencies)

    {

        if (
array_key_exists($paramName $parameter->getName(), $parameters)) {

            
$dependencies[] = $parameters[$paramName];



            unset(
$parameters[$paramName]);
            unset($parameters[$paramName]);

        } elseif (! 
is_null($className Util::getParameterClassName($parameter))) {

            if (
array_key_exists($className$parameters)) {

                
$dependencies[] = $parameters[$className];



                unset(
$parameters[$className]);
            }

        } elseif (
$parameter->isDefaultValueAvailable()) {

            
$dependencies[] = $parameter->getDefaultValue();

        } elseif (! 
$parameter->isOptional() && ! array_key_exists($paramName$parameters)) {

            
$message "Unable to resolve dependency [{$parameter}] in class {$parameter->getDeclaringClass()->getName()}";



            throw new 
BindingResolutionException($message);