note 77651 deleted from language.oop5.autoload by peehaa
| From: | peehaa@php.net | Date: | Mon, 08 Jul 2013 20:43:17 +0000 |
| Subject: | note 77651 deleted from language.oop5.autoload by peehaa | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-195527@lists.php.net to get a copy of this message | ||
Note Submitter: knoopx at gmail dot com
----
Quick and easiest way to be able to throw exceptions on __autoload() method:
<?php
function __autoload($class_name) {
find_file($class_name); //your own routine to locate the class file
if (!class_exists($class_name, false)) {
eval("class $class_name {}");
throw new Exception('Class not found');
}
}
?>