Using __autoload() is deprecated

Defining the __autoload() function used to be the way to create a autoloading mechanism for classes, traits, interfaces and enumerations. This was later replaced by the spl_autoload_register() function, which allows adding and removing autoloading functions. Ever since, creating the __autoload() function is reported as deprecated, and the function is not used since PHP 8.0.

PHP code

<?php

function __autoload() {}

?>

Before

PHP Fatal error:  __autoload() is no longer supported, use spl_autoload_register() instead in /codes/autoload.php on line 3

Fatal error: __autoload() is no longer supported, use spl_autoload_register() instead in /codes/autoload.php on line 3

After

PHP Fatal error:  __autoload() is no longer supported, use spl_autoload_register() instead in /codes/autoload.php on line 3
Stack trace:
#0 {main}

Fatal error: __autoload() is no longer supported, use spl_autoload_register() instead in /codes/autoload.php on line 3
Stack trace:
#0 {main}

PHP version change

This behavior changed in 8.0