3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Demo { protected string $foo { get => "virtual"; } } $d = new Demo(); var_dump( $d ); var_dump( (array)$d );
Output for 8.4.1 - 8.4.10
object(Demo)#1 (0) { } array(0) { }
Output for 8.2.0 - 8.2.29, 8.3.0 - 8.3.23
Parse error: syntax error, unexpected token "{", expecting "," or ";" in /in/Y89G3 on line 4
Process exited with code 255.

preferences:
180.11 ms | 1081 KiB | 8 Q