3v4l.org

run code in 500+ PHP versions simultaneously
<?php //declare(strict_types = 1); interface FooIface{} class FooClass{} function fooNullable(?string $a,?int $b, ?float $c, ?bool $d, ?FooIface $e, ?FooClass $g) : ?int {} function foo ( string $a, int $b, float $c, bool $d, FooIface $e, FooClass $g) : int {} function printTypes(string $fn) { $reflectionFunction = new \ReflectionFunction($fn); $functionParameters = $reflectionFunction->getParameters(); foreach ($functionParameters as $parameter) { var_dump($parameter->getType()->__toString()); } echo "return:"; var_dump($reflectionFunction->getReturnType()->__toString()); return; } echo " ---not nullable--- "; printTypes('foo'); echo " --nullable-- "; printTypes('fooNullable');
Output for git.master, git.master_jit, rfc.property-hooks
---not nullable--- string(6) "string" string(3) "int" string(5) "float" string(4) "bool" string(8) "FooIface" string(8) "FooClass" return:string(3) "int" --nullable-- string(7) "?string" string(4) "?int" string(6) "?float" string(5) "?bool" string(9) "?FooIface" string(9) "?FooClass" return:string(4) "?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:
92.78 ms | 1740 KiB | 4 Q