3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php namespace Foo { class FooClass { public function test() { echo "Hello World"; } } } namespace Bar { $className = 'Foo\\FooClass'; $a = new $className(); $a->test(); $b = new Foo\FooClass(); $b->test(); }
based on 9EU5n
Output for 7.0.0 - 7.2.0
Hello World Fatal error: Uncaught Error: Class 'Bar\Foo\FooClass' not found in /in/iqHLW:16 Stack trace: #0 {main} thrown in /in/iqHLW on line 16
Process exited with code 255.
Output for 5.3.21 - 5.6.28
Hello World Fatal error: Class 'Bar\Foo\FooClass' not found in /in/iqHLW on line 16
Process exited with code 255.