← All docs

array_first()

Returns the first value of an array in insertion order, or null when it is empty.

array_first()

function array_first(array $array): mixed

Returns the first value of an array in insertion order, or null when it is empty.

Parameters:

  • $array (array)

Returns: mixed

Availability

Compiled (AOT)Magician (eval)
AvailableNot available yet

No examples yet. Check examples/ and showcases/ for usage patterns.

Internals

For how array_first is implemented in the compiler, see the internals page.