|
array_key_firstGets the first key of an array Description
intstringnull array_key_first(array
$array )
Get the first key of the given Parameters
Return Values
Returns the first key of Examples
Example #1 Basic array_key_first Usage
The above example will output: string(1) "a" NotesTip
There are several ways to provide this functionality for versions prior to PHP 7.3.0. It is possible to use array_keys, but that may be rather inefficient. It is also possible to use reset and key, but that may change the internal array pointer. An efficient solution, which does not change the internal array pointer, written as polyfill:
See Also
|