3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { public $field; } class B { public string $field; } $a = new A(); $b = new B(); var_dump($a->field); var_dump($b->field);
Output for 8.0.1 - 8.0.30, 8.1.0 - 8.1.30, 8.2.0 - 8.2.24, 8.3.0 - 8.3.12
NULL Fatal error: Uncaught Error: Typed property B::$field must not be accessed before initialization in /in/9KReD:17 Stack trace: #0 {main} thrown in /in/9KReD on line 17
Process exited with code 255.

preferences:
59.46 ms | 406 KiB | 5 Q