3v4l.org

run code in 300+ PHP versions simultaneously
<?php function calc($x) { return function($y = null) use ($x) { if (is_callable($y)) { return $y(...$x); } else { $args = (array) $x; $args[] = $y; return calc($args); } }; } $sum = function(...$args) { return array_sum($args); }; echo calc(5)(3)(2)($sum), PHP_EOL; echo calc(1)(2)($sum), PHP_EOL; echo calc(2)(3)('pow'), PHP_EOL;
Output for git.master, git.master_jit, rfc.property-hooks
10 3 8

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:
37.77 ms | 405 KiB | 5 Q