3v4l.org

run code in 300+ PHP versions simultaneously
<?php function volume(int $x, int $y, int $z): int { return $x * $y * $z; } $p = fn(int $z): int => volume(3, 5, $z); // This is a useful and common way to normalize different types of callable // to a single API for reflection purposes. $c = Closure::fromCallable($p); $ref = new ReflectionFunction($c); print $ref->getNumberOfParameters() . PHP_EOL; print $ref->getParameters()[0]->getType() . PHP_EOL; print $ref->getParameters()[0]->getName() . PHP_EOL; print $ref->getReturnType() . PHP_EOL;
Output for git.master, git.master_jit, rfc.property-hooks
1 int z int

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:
93.31 ms | 1382 KiB | 4 Q