3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php interface Lol { const TEST = 'Lol'; } class Foo { const TEST = 'Foo'; } class Bar {} var_dump((new Foo())::TEST); var_dump((new Bar())::TEST);
based on 20GEf
Output for 7.0.0 - 7.3.0rc3
string(3) "Foo" Fatal error: Uncaught Error: Undefined class constant 'TEST' in /in/3q8uU:16 Stack trace: #0 {main} thrown in /in/3q8uU on line 16
Process exited with code 255.
Output for hhvm-3.15.4
Fatal error: Uncaught Error: syntax error, unexpected T_DOUBLE_COLON, expecting ')' in /in/3q8uU:15 Stack trace: #0 {main}
Process exited with code 255.
Output for 5.6.0 - 5.6.30
Parse error: syntax error, unexpected '::' (T_PAAMAYIM_NEKUDOTAYIM) in /in/3q8uU on line 15
Process exited with code 255.