3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php namespace Example { // Internal declaration namespace Foo { 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: Namespace declarations cannot be nested in /in/0JX26 on line 4
Process exited with code 255.