3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { public function foo(): ?int { return 1; } public function baz() { return 2; } } $foo = new ReflectionMethod((new A), "foo"); $baz = new ReflectionMethod((new A), "baz"); echo "foo: " . $foo->getReturnType(); echo "\n"; echo "baz: " . $baz->getReturnType();
Output for 8.1.0 - 8.1.30, 8.2.0 - 8.2.25, 8.3.0 - 8.3.13
foo: ?int baz:

preferences:
46.17 ms | 406 KiB | 5 Q