getLastValue

Definition

1
Arr::getLastValue(array $array): mixed|null
Copied!

Description

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

Examples

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