please may someone help to fix this problem,I tried to use spl_autoload_register to replace auto load function
function spl_autoload_register( function($class_name) {
$class_name = strtolower($class_name);
$path = LIB_PATH.DS."{$class_name}.php";
if(file_exists($path)){
require_once($path);
}else{
die("The file {$class_name}.php could not be found.");
}
})
The error is due to putting
functionin front of thespl_autoload_register. It should be as follow:Remember, you are not creating the
spl_autoload_registerfunction, you're calling it. calling is as follow:functionToCall();You then pass an anonymous function to yourspl_autoload_registeras an argument.