3v4l.org

run code in 300+ PHP versions simultaneously
<?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.3.28, 5.4.0 - 5.4.27
Fatal error: Namespace declarations cannot be nested in /in/0JX26 on line 4
Process exited with code 255.

preferences:
174.61 ms | 1399 KiB | 64 Q