The whole idea of autoloading classes is that you don't need to worry about this anymore. To achieve this, once you added your individual autoloading function, it will be used.
Say you have the following setup:
index.php
spl_autoload_register(function ($class) {
//something
});
$a = new Foo();
and the file where Foo
is routed to
class Foo extends Bar {
public function __construct() {
$b = new Baz();
}
}
Since the autoloading was already invoked when searching for Foo
, the same rules will now apply to find Bar
and Baz
.
This means once you defined your personal autoloading rules, PHP will go with them (until you redefine). This doesn't only work for inheritence but regular class calls inside your classes as well.