@ 2014-02-05T23:56:23Z <?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())))));
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Output for 7.0.0 - 7.0.20 , 7.1.0 - 7.1.33 , 7.2.0 - 7.2.33 , 7.3.0 - 7.3.33 , 7.4.0 - 7.4.33 , 8.0.0 - 8.0.30 , 8.1.0 - 8.1.27 , 8.2.0 - 8.2.17 , 8.3.0 - 8.3.4 Fatal error: Uncaught Error: Call to undefined function two() in /in/pso1h:33
Stack trace:
#0 {main}
thrown in /in/pso1h on line 33
Process exited with code 255 . Output for 5.3.0 - 5.3.29 , 5.4.0 - 5.4.45 , 5.5.24 - 5.5.35 , 5.6.8 - 5.6.28 Fatal error: Call to undefined function two() in /in/pso1h on line 33
Process exited with code 255 . Output for 4.4.2 - 4.4.9 , 5.1.0 - 5.1.6 , 5.2.0 - 5.2.17 Parse error: syntax error, unexpected T_FUNCTION in /in/pso1h on line 4
Process exited with code 255 . Output for 4.3.0 - 4.3.1 , 4.3.5 - 4.3.11 , 4.4.0 - 4.4.1 , 5.0.0 - 5.0.5 Parse error: parse error, unexpected T_FUNCTION in /in/pso1h on line 4
Process exited with code 255 . Output for 4.3.2 - 4.3.4 Parse error: parse error in /in/pso1h on line 4
Process exited with code 255 . preferences:dark mode live preview
239.72 ms | 401 KiB | 354 Q