3v4l.org

run code in 300+ PHP versions simultaneously
<?php function number_factory($num) { return function($operation) use ($num) { return $operation ? $operation($num) : $num }; } function operation_factory($operation) { return function($b) use ($operation) { return function($a) use ($b, $operation) { return $operation($a, $b); }; }; } $plus = operation_factory(function($a, $b) { return $a+$b; }); $minus = operation_factory(function($a, $b) { return $a-$b; }); $times = operation_factory(function($a, $b) { return $a*$b; }); $dividedBy = operation_factory(function($a, $b) { return $a/$b; }); $zero = number_factory(0); $one = number_factory(1); $two = number_factory(2); $three = number_factory(3); $four = number_factory(4); $five = number_factory(5); $six = number_factory(6); $seven = number_factory(7); $eight = number_factory(8); $nine = number_factory(9); print(two(plus(three(minus(two())))));
Output for 5.3.0 - 5.3.28, 5.4.0 - 5.4.24
Parse error: syntax error, unexpected '}' in /in/R6hLu on line 6
Process exited with code 255.

preferences:
182.47 ms | 1395 KiB | 61 Q