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?->__invoke(3);
Output for 8.0.0 - 8.0.3
Parse error: syntax error, unexpected token "?" in /in/ERRdY on line 9
Process exited with code 255.
Output for 7.3.0 - 7.3.28, 7.4.0 - 7.4.16
Parse error: syntax error, unexpected '->' (T_OBJECT_OPERATOR) in /in/ERRdY on line 7
Process exited with code 255.