3v4l.org

run code in 300+ PHP versions simultaneously
<?php $f = new class { public function bar(int $a) { print $a . PHP_EOL; } }; $res = $f?->bar(5); $c = $f?->bar(?); $c(4); $g = null; $d = $g?->bar(?); $d(3);

preferences:
159.64 ms | 1385 KiB | 7 Q