Skip to content

Kirby 6.0.1

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

Kirby\Toolkit\A

Examples

$array = [
  'cat'  => 'miao',
  'dog'  => 'wuff',
  'bird' => 'tweet'
];

$last = A::last($array);
// last: 'tweet'