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;

This is an error 500

Value for `_results` contains invalid data `array`


preferences:
152 ms | 2004 KiB | 11 Q