getLastKey

Definition

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

Description

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

Examples

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