3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MyParent { public string $myProp { get => "foo"; } } class MyChild extends MyParent { public string $myProp { get => "foo"; set {} } } $p = new MyChild; $p->myProp = "lol"; var_dump($p); $p = new MyParent; $p->myProp = "lol"; var_dump($p);
Output for 8.1.0 - 8.1.29, 8.2.0 - 8.2.22, 8.3.0 - 8.3.10
Parse error: syntax error, unexpected token "{", expecting "," or ";" in /in/t5ebW on line 4
Process exited with code 255.

preferences:
156.31 ms | 1424 KiB | 7 Q