3v4l.org

run code in 300+ PHP versions simultaneously
<?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.3.28, 5.4.0 - 5.4.27
Fatal error: No code may exist outside of namespace {} in /in/lUnlJ on line 36
Process exited with code 255.

preferences:
180.22 ms | 1395 KiB | 64 Q