3v4l.org

run code in 500+ PHP versions simultaneously
<?php class X { public string $p { set(string|A|null $value) { $this->p = (string) $value; } get => $this-p . ' more'; } } class A { function __toString() { return 'abc'; } } $x = new X; $x->p = new A;
Output for 8.4.9 - 8.4.24, 8.5.6 - 8.5.9
Output for 8.2.31 - 8.2.32, 8.3.5 - 8.3.33
Parse error: syntax error, unexpected token "{", expecting "," or ";" in /in/vuKfQ on line 5
Process exited with code 255.

preferences:
49.44 ms | 541 KiB | 4 Q