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: - Introduced in WordPress: 6.8.0
- Deprecated in WordPress: —
Description
Polyfill for `array_find()` function added in PHP 8.4.Searches an array for the first element that passes a given callback.