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 3q8uU
Output for 7.0.0 - 7.3.1
string(3) "Foo" Fatal error: Uncaught Error: Undefined class constant 'TEST' in /in/VI65c:18 Stack trace: #0 {main} thrown in /in/VI65c 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/VI65c: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/VI65c on line 18
Process exited with code 255.