__autoload() is no longer supported, use spl_autoload_register() instead
Description
The initial autoloader was a custom function, that was called whenever a class, interface or trait had to be loaded, but could not be found by PHP yet.
This approach was useful, but limited management operation: in particular, it was not possible to add more functions, or remove some of them. So, it was replaced with the spl_autoload_register() function, which add a closure to a list of autoloaders.
Example
<?php
function __autoload() {}
?>
Alternatives
- Give another name to the
__autoloadfunction, and register it as autoloader with spl_autoload_register(). - Remove the
__autoloadfunction.
In previous PHP versions, this error message used to be :ref:autoload()-is-deprecated,-use-spl_autoload_register()-instead.