#file1
spl_autoload_register(function($class){
require_once "{$class}.php";
});
new classes\Foo();
#file2
namespace classes;
class Foo implements toolInterface {
function __construct(){
echo __CLASS__;
}
public function tool(){
}
}
I have a problem with spl_autoload_register, above example works fine, but when I try to use use classes
it will have fatal error, anyone know how to solve this problem?
//fatal error
spl_autoload_register(function($class){
require_once "{$class}.php";
});
use classes;
new Foo();