3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php interface Lol { const TEST = 'Lol'; } class Foo { const TEST = 'Foo'; } class Bar {} $foo = new Foo(); var_dump($foo::TEST); $bar = new Bar(); var_dump(Bar::TEST);
based on jIEsF
Output for 7.0.0 - 7.2.6
string(3) "Foo" Fatal error: Uncaught Error: Undefined class constant 'TEST' in /in/QtP82:18 Stack trace: #0 {main} thrown in /in/QtP82 on line 18
Process exited with code 255.
Output for hhvm-3.15.4
string(3) "Foo" Fatal error: Uncaught Error: Couldn't find constant Bar::TEST in /in/QtP82:18 Stack trace: #0 {main}
Process exited with code 255.
Output for 5.6.0 - 5.6.30
string(3) "Foo" Fatal error: Undefined class constant 'TEST' in /in/QtP82 on line 18
Process exited with code 255.