3v4l.org

run code in 300+ PHP versions simultaneously
<?php $x = new stdClass(); $x->a->b = 1; var_dump($x);
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.25, 8.4.1 - 8.4.12
Fatal error: Uncaught Error: Attempt to assign property "b" on null in /in/9T4j6:4 Stack trace: #0 {main} thrown in /in/9T4j6 on line 4
Process exited with code 255.
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.20, 7.2.5 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33
Warning: Creating default object from empty value in /in/9T4j6 on line 4 object(stdClass)#1 (1) { ["a"]=> object(stdClass)#2 (1) { ["b"]=> int(1) } }

preferences:
105.07 ms | 408 KiB | 5 Q