3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php namespace Foo { class Bar { function baz() { return time(); } } } namespace { class Test { public static $now; function call() { $namespace = '\\Foo'; eval('namespace '.$namespace.' { function time() { return \\'.__CLASS__.'::$now ?: \time(); } }'); } } } $b = new Foo\Bar(); $t = new Test(); $t->call(); Test::$now = 'xxx'; $b->baz();
Output for 5.3.0 - 5.4.12
Fatal error: No code may exist outside of namespace {} in /in/Nqq30 on line 26
Process exited with code 255.