3v4l.org

run code in 300+ PHP versions simultaneously
<?php // lint >= 8.4 namespace AbstractFinalHook; final class User { private string $private = 'mailto: example.org' { get => 'private:' . $this->private; } final public string $final = 'mailto: example.org' { get => 'final:' . $this->final; } final protected string $protected = 'mailto: example.org' { get => 'protected:' . $this->protected; } final private string $email = 'mailto: example.org' { get => 'mailto:' . $this->email; } function doFoo(): void { $u = new User; var_dump($u->private); var_dump($u->protected); var_dump($u->final); var_dump($u->email); unset($u->email); } }
Output for 8.4.1 - 8.4.4
Fatal error: Property cannot be both final and private in /in/5ZXOF on line 19
Process exited with code 255.
Output for 8.2.0 - 8.2.27, 8.3.0 - 8.3.17
Parse error: syntax error, unexpected token "=>" in /in/5ZXOF on line 8
Process exited with code 255.

preferences:
150.51 ms | 997 KiB | 7 Q