Comparisons\isLessThanOrEqualTo()

predicate returns Closure returns bool pure
number → (number → bool)
At a glance — value <= threshold as a reusable predicate.

Creates a predicate Closure that is true when the passed number is less than or equal to the bound number.

/**
  * @param int|float $a
  * @return Closure(int|float):bool
  */
Comparisons\isLessThanOrEqualTo($a): Closure

Returned Closure

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

/**
  * @param int|float $b
  * @return bool
  */
$function ($b): bool

Examples

Partial Application

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

$max100 = Comparisons\isLessThanOrEqualTo(100);

var_dump($max100(100)); // true
var_dump($max100(101)); // false

$inRange = array_filter([50, 100, 150], $max100);
print_r($inRange); // [50, 100]

Details

Comparisons Functions

Releated Ordering Functions