3v4l.org

run code in 500+ PHP versions simultaneously
<?php class Foo { public function __construct( public ?string $prop = null, ) {} } class Bar extends Foo { public function __construct( public ?string $bar = null, ) {} } // Echoes nothing, but it works as expected. echo (new Bar())->prop;
Output for 8.0.1 - 8.0.30, 8.1.0 - 8.1.34, 8.2.0 - 8.2.32, 8.3.0 - 8.3.32, 8.4.1 - 8.4.23, 8.5.0 - 8.5.8
Fatal error: Uncaught Error: Typed property Foo::$prop must not be accessed before initialization in /in/5WtJa:18 Stack trace: #0 {main} thrown in /in/5WtJa on line 18
Process exited with code 255.

preferences:
73.08 ms | 1172 KiB | 4 Q