Creates a Closure that returns true when at least one element of an array or iterable passes the predicate. Short-circuits on the first match.
/**
* @param callable(mixed):bool $function
* @return Closure(iterable<int|string, mixed>):bool
*/
Arrays\filterAny(callable $function): ClosureWhen Arrays\filterAny() is called, it returns the following Closure which can be used like a regular function.
/**
* @param iterable<int|string, mixed> $source
* @return bool
*/
$function (iterable $source): boolThis can be used to create a simple closure which can be used as a regular function.
$anyNegative = Arrays\filterAny(fn($v) => $v < 0);
var_dump($anyNegative([1, 2, 3])); // false
var_dump($anyNegative([1, -2, 3])); // trueThis can be called inline using currying.
var_dump(Arrays\filterAny('is_string')([1, 2, 'three'])); // true