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.28, 8.5.0 - 8.5.13, 8.6.0
Output for 8.2.31 - 8.2.36, 8.3.0 - 8.3.37
Parse error: syntax error, unexpected token "{", expecting "," or ";" in /in/vuKfQ on line 5
Process exited with code 255.

preferences:
15 ms | 1166 KiB | 6 Q