← All docs

key()

Returns the key of the element under the array's internal pointer.

key()

function key(array $array): mixed

Returns the key of the element under the array’s internal pointer.

Parameters:

  • $array (array)

Returns: mixed

Availability

No examples yet — check examples/ and showcases/ for usage patterns.

Internals

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