Faizy Faizy - 5 months ago 10
PHP Question

Parsing error in php

function __autoload($class_name) {
$class_name = strtolower($class_name);
$path = "{$class_name}.php";
if(file_exists($path)) {
require_once($path);
}else {
//die 'The file'.$class_name.'.php could not be found.';
die "The file {$class_name}.php does not exists";
}


}

There is some parsing error in the last line can anyone correct these and the error are
C:\xampp\htdocs\demo\oop\includes\functions.php on line 23

Answer
    function __autoload($class_name) {
        $class_name = strtolower($class_name);
        $path = "{$class_name}.php";
        if (file_exists($path)) {
            require_once($path);
        } else {
            //die 'The file'.$class_name.'.php could not be found.';
            die ("The file {$class_name}.php does not exists");
        }
    }

echo, print, include* and require* may be used without round brackets, but not die.