array_find_key


array_find_key ( $array, $callback )

Parameters:
  • (array) array The array to search.
  • (callable) callback The callback to run for each element.
Returns:
  • (int|string|null) The first key in the array that passes the `$callback`, otherwise null.
Defined at:

Description

Polyfill for `array_find_key()` function added in PHP 8.4.Searches an array for the first key that passes a given callback.

Related Functions

array_find, array_any, array_key_last, array_key_first, array_is_list

Top Google Results

User discussions

wpseek mobile