array_key_first( array $arr )
Polyfill for array_key_first() function added in PHP 7.3.
Description
Get the first key of the given array without affecting the internal array pointer.
Parameters
- $arr
-
(array) (Required) An array.
Return
(string|int|null) The first key of array if the array is not empty; null
otherwise.
Source
File: wp-includes/compat.php
function array_key_first( array $arr ) { foreach ( $arr as $key => $value ) { return $key; } }
Expand full source code Collapse full source code View on Trac View on GitHub
Changelog
Version | Description |
---|---|
5.9.0 | Introduced. |