3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait C { private static $FOO = self::NAME . ' FOO'; } class D { use C; const NAME = 'D'; } class E { use C; const NAME = 'E'; } var_dump(C::$FOO); var_dump(D::$FOO); var_dump(E::$FOO);
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Fatal error: Uncaught Error: Cannot access private property C::$FOO in /in/CeS9b:17 Stack trace: #0 {main} thrown in /in/CeS9b on line 17
Process exited with code 255.
Output for 5.6.0 - 5.6.30
Fatal error: Cannot access private property C::$FOO in /in/CeS9b on line 17
Process exited with code 255.
Output for 5.4.0 - 5.4.45, 5.5.0 - 5.5.38
Parse error: syntax error, unexpected '.', expecting ',' or ';' in /in/CeS9b on line 4
Process exited with code 255.

preferences:
193.18 ms | 402 KiB | 287 Q