3v4l.org

run code in 300+ PHP versions simultaneously
<?php function trampoline_factorial($n, $acc = 1) { if ($n == 1) { echo $n . PHP_EOL; return $acc; } echo $n . PHP_EOL; return function() use ($n, $acc) { return trampoline_factorial($n-1, $n * $acc); }; } function trampoline(callable $c, ...$args) { while (is_callable($c)) { $c = $c(...$args); } return $c; } echo trampoline('trampoline_factorial', 5);
Output for git.master, git.master_jit, rfc.property-hooks
5 4 3 2 1 120

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:
26.22 ms | 1947 KiB | 4 Q