Skip to content

Kirby 6.0.0

A::first()

Returns the first element of an array

A::first(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'
];

$first = A::first($array);
// first: 'miao'