UTILITY

find_key()

Return the key of the first matching array item.

Signature

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

Example

find_key(['a'=>3,'b'=>8], fn($n) => $n > 5); // 'b'

Available from: 1.5.0

Reference navigation

Previous: find()

Next: flatten()

Back to utilities