matteosister / php-curry

Curried functions for PHP
61 stars 1 forks source link

Added support for Operators #11

Closed jasny closed 1 year ago

jasny commented 6 years ago
use Cypress\Curry as C;

$addTen = C\curry('+', 10);
echo $addTen(4); // output 14

$atLeast10 = C\curry('>=', 10);
echo $atLeast10(1) ? 'more' : 'less'; // output less
Operator types
Arithmetic Operators +, -, *, /, %, **
Bitwise Operators &, , ^, ~, <<, >>
Comparison Operators ==, ===, !=, !==, <, >, <=, >=
Logical Operators and/&&, or/∣∣, xor, !/not
String Operator .