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 git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught ArgumentCountError: Too few arguments to function {closure}(), 0 passed in /in/roWqQ on line 33 and exactly 1 expected in /in/roWqQ:4 Stack trace: #0 /in/roWqQ(33): {closure}() #1 {main} thrown in /in/roWqQ on line 4
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
47.85 ms | 401 KiB | 8 Q