<?php
spl_autoload_register('var_dump');
spl_autoload_register(function ($class) {
eval('class '.ltrim('\\', $class).' { }');
});
new Foo();
new \Foo();
use Foo\Bar;
new Bar();
use Foo\Baz as Cat;
new Cat();
use Foo\Ciz;
new Ciz\Caz();
string(3) "Foo"
Parse error: syntax error, unexpected token "\", expecting identifier in /in/8HQiK(5) : eval()'d code on line 1
Process exited with code 255.
string(3) "Foo"
Parse error: syntax error, unexpected '\' (T_NS_SEPARATOR), expecting identifier (T_STRING) in /in/8HQiK(5) : eval()'d code on line 1
Process exited with code 255.
string(3) "Foo"
Parse error: syntax error, unexpected '\' (T_NS_SEPARATOR), expecting identifier (T_STRING) in /in/8HQiK(5) : eval()'d code on line 1
Fatal error: Class 'Foo' not found in /in/8HQiK on line 8
Process exited with code 255.
Output for 5.3.0 - 5.3.29
string(3) "Foo"
Parse error: syntax error, unexpected T_NS_SEPARATOR, expecting T_STRING in /in/8HQiK(5) : eval()'d code on line 1
Fatal error: Class 'Foo' not found in /in/8HQiK on line 8
Process exited with code 255.