3v4l.org

run code in 500+ PHP versions simultaneously
<?php interface I { public $x { get; } } class C implements I { private $_x; public $x { get => $this->_x; } } var_dump((new ReflectionProperty(C::class, 'x'))->isVirtual()); // should be: bool(true) $c = new C; $c->x = 3; // should throw an error: 'Property C::$x is read-only'
Output for 8.3.5
Parse error: syntax error, unexpected token "{", expecting "," or ";" in /in/ed1TG on line 4
Process exited with code 255.

preferences:
41.88 ms | 493 KiB | 3 Q