3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php // Internal declaration namespace Test { class Foo { public static function bar() { return 'static'; } } } // Internal Usage namespace Controller { use Test\Foo; class SomeController { public function view() { echo Foo::bar(); } } } // Some extending application class MyFoo extends Foo { public static function bar() { return 'can\'t make internal methods use this.'; } } $c = new Controller\SomeController; $c->view();
Output for 5.3.0 - 5.4.27
Fatal error: No code may exist outside of namespace {} in /in/lUnlJ on line 36
Process exited with code 255.