Fatal error: __autoload() is no longer supported, use spl_autoload_register() instead in D:XAMPPhtdocsmarimarincludesfunctions.php on line 37

I am trying to run some of my code by each time, I am getting this error, I am using the latest version of PHP.

I replaced my caused as per the error; from this

function __autoload($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.");
        }

to this

function spl_autoload_register($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.");
        }

then got another error message

Fatal error: Cannot redeclare spl_autoload_register() in D:XAMPPhtdocsmarimarincludesfunctions.php on line 37

Any help on how to solve this.
here is the complete code.