3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php namespace foo { trait A { function B() { var_dump(self::class); } } } namespace { class B { use \foo\A; } class C { use \foo\A; } class D extends C {} function main() { (new B)->B(); (new C)->B(); (new D)->B(); } }
Output for 7.0.0 - 7.2.0
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; B has a deprecated constructor in /in/vH4PJ on line 8
Output for 5.5.24 - 5.6.28
Output for 5.4.10 - 5.4.45
Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in /in/vH4PJ on line 4
Process exited with code 255.
Output for 5.3.20 - 5.3.29
Parse error: syntax error, unexpected T_STRING in /in/vH4PJ on line 4
Process exited with code 255.