array_find


array_find ( $array, $callback )

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

Description

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

Related Functions

array_find_key, array_any, array_key_first, array_all, array_is_list

Top Google Results

User discussions

wpseek mobile