Roy Harper
Coder
Hello. I am trying to use spl_autoload_register but it returns an error saying "Uncaught Error: Class 'Functions' not found in..." Here is my code:
When I try removing the
there is no error. What could possibly the reason why this is happening?
PHP:
spl_autoload_register(function($className) {
$path = "classes/";
$extension = ".php";
$fullPath = $path.$className.$extension;
if(!file_exists($fullPath)){
return false;
}
require_once $fullPath;
});
$fnObj = new Functions();
When I try removing the
PHP:
if(!file_exists($fullPath)){
return false;
}
there is no error. What could possibly the reason why this is happening?