A::last()
Returns the last element of an array
A::last(array $array): mixed|null
Parameters
| Name | Type | Default |
|---|---|---|
| $arrayrequired | array<mixed> |
no default value |
Return types
mixedornull
Parent class
Examples
$array = [
'cat' => 'miao',
'dog' => 'wuff',
'bird' => 'tweet'
];
$last = A::last($array);
// last: 'tweet'