Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Fetch a key from an array
<?php key(array|object $array): int|string|null
<?php         foreach ($this->items as $key => $item) {

            $pair = $callback($item, $key);



            $key = key($pair);



            $value = reset($pair);
<?php         $field = 'answer';



        if (is_array($rules) && ! array_is_list($rules)) {

            [$field, $rules] = [key($rules), current($rules)];

        }



        return $this->getPromptValidatorInstance(
<?php                 return;

            }



            $index = key($matches);

        } else {

            $index = $this->getSelectedCommandByIndex($commandNames);

        }
<?php     {

        $relation = array_shift($path);



        $name = explode(':', key($relation))[0];



        if (is_string(reset($relation))) {

            $relation = reset($relation);
<?php             );

        }



        return app('cache')->put(key($arguments[0]), reset($arguments[0]), $arguments[1] ?? null);

    }

}
<?php         $extensions = $factory->getExtensions();

        $this->assertSame('bar', reset($extensions));

        $this->assertSame('foo', key($extensions));

    }



    public function testPrependedExtensionOverridesExistingExtensions()
<?php         $extensions = $factory->getExtensions();

        $this->assertSame('bar', reset($extensions));

        $this->assertSame('baz', key($extensions));

    }



    public function testCallCreatorsDoesDispatchEventsWhenIsNecessary()