UTILITY

find()

Return the first array item matching a callback.

Signature

mixed find(array $array, callable $callback, mixed $default = null)

Example

find([3, 8, 12], fn($n) => $n > 10); // 12

Available from: 1.5.0

Reference navigation

Previous: filled()

Next: find_key()

Back to utilities