3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { int $x = null; } $a = [new class A()]; foreach ($a as $b) { var_dump($a['x']->x ?? 0); }
Output for 8.3.0 - 8.3.30, 8.4.1 - 8.4.18, 8.5.0 - 8.5.3
Parse error: syntax error, unexpected identifier "int", expecting "function" in /in/VTLOY on line 4
Process exited with code 255.

preferences:
155.49 ms | 1086 KiB | 7 Q