3v4l.org

run code in 500+ PHP versions simultaneously
<?php class x { function __construct( int &$y { get => $this->y; }, ) {} } $w = 4; $x = new x($w);
Output for 8.4.1 - 8.4.10
Fatal error: Uncaught Error: Typed property x::$y must not be accessed before initialization in /in/RH1V7:5 Stack trace: #0 /in/RH1V7(5): x->$y::get() #1 /in/RH1V7(10): x->__construct(4) #2 {main} thrown in /in/RH1V7 on line 5
Process exited with code 255.
Output for 8.2.0 - 8.2.29, 8.3.0 - 8.3.23
Parse error: syntax error, unexpected token "{", expecting ")" in /in/RH1V7 on line 5
Process exited with code 255.

preferences:
48.01 ms | 758 KiB | 3 Q