3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php abstract class C { const NAME = ''; static $FOO = self::NAME . ' FOO'; } class D extends C { const NAME = 'D'; } class E extends C { const NAME = 'E'; } var_dump(C::FOO); var_dump(D::FOO); var_dump(E::FOO);
based on TeCi5
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught Error: Undefined class constant 'FOO' in /in/MBN3P:16 Stack trace: #0 {main} thrown in /in/MBN3P on line 16
Process exited with code 255.
Output for 5.6.7 - 5.6.28
Fatal error: Undefined class constant 'FOO' in /in/MBN3P on line 16
Process exited with code 255.
Output for 5.3.17 - 5.5.35
Parse error: syntax error, unexpected '.', expecting ',' or ';' in /in/MBN3P on line 5
Process exited with code 255.