3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public string $ref { get => $this->_ref; set => $this->_ref = $value; } public function __construct( private string &$_ref, ) {} } $var = 'hello'; $foo = new Foo($var); $foo->ref = 'world'; echo $var;
Output for 8.4.1 - 8.4.11
world
Output for 8.2.0 - 8.2.29, 8.3.0 - 8.3.24
Parse error: syntax error, unexpected token "{", expecting "," or ";" in /in/0cC0S on line 5
Process exited with code 255.

preferences:
156.38 ms | 1001 KiB | 7 Q