Comparisons\groupOr()

higher-order predicate variadic returns Closure returns bool pure
...(T → bool) → (T → bool)
At a glance — OR-combinator for predicates. See also any (alias).

Creates a predicate Closure that is true when at least one of the bound predicates returns true for the input value.

/**
  * @param callable(mixed):bool ...$callables
  * @return Closure(mixed):bool
  */
Comparisons\groupOr(callable ...$callables): Closure

Returned Closure

When Comparisons\groupOr() is called, it returns the following Closure which can be used like a regular function.

/**
  * @param mixed $value
  * @return bool
  */
$function ($value): bool

Examples

Partial Application

This can be used to create a simple closure which can be used as a regular function.

$stringOrInt = Comparisons\groupOr('is_string', 'is_int');

var_dump($stringOrInt('hello')); // true
var_dump($stringOrInt(42));      // true
var_dump($stringOrInt(3.14));    // false

Details

Comparisons Functions

Releated Combinators Functions