__autoload function throws exceptions, even if 'return true' called previously

CizkniniaEmag

New Member
I'm creating on my \[code\]__autoload()\[/code\] function. in the function I check if the requested class already exists and return true if yesif the class still does not exist at the end of function, I throw an exception...but the exception is thrown even if class is loaded. Why is it so? I expected the function will terminate when \[code\]return\[/code\] is called..\[code\]public function load($class, $path = false) { if(class_exists($class)) { return true; } //here the code searches for the class file if(class_exists($class)) { return true; } throw new \Exception("Class $class not found"); }\[/code\]
 
Top