3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { public 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 "A", expecting "{" in /in/D0pHg on line 8
Process exited with code 255.

preferences:
152.23 ms | 1086 KiB | 7 Q