getFirstKey

Definition

1
Arr::getFirstKey(array $array): int|string|null
Copied!

Description

Get the first key of the given array without affecting the internal array pointer.
Returns null if array is empty.

Examples

1
Arr::getFirstKey(['a' => 1, 'b' => 2, 'c' => 3]) -> 'a'
2
3
Arr::getFirstKey([1, 2, 3]) -> 0
4
5
Arr::getFirstKey([]) -> null
Copied!
Last modified 2yr ago
Copy link