I have a website that was created with php 5.6 and need to update to php8.0.10.
So, in this firts troble we have a function __autoload that is no longer supported.
How can a I change to spl_autoload_register?
Look my code:
function __autoload($className) {
$classpath = array(
'model/','helpers/','plugin/email/',//frontend
'../model/','../helpers/','../plugin/email/'//backend
);
$classFile = ucfirst($className) . ".php";
$loaded = false;
foreach ($classpath as $path) {
if (is_readable("$path$classFile")) {
require "$path$classFile";
$loaded = true;
break;
}
}
}