note 97140 deleted from language.oop5.autoload by crell
| From: | crell@php.net | Date: | Mon, 04 Apr 2022 16:33:34 +0000 |
| Subject: | note 97140 deleted from language.oop5.autoload by crell | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-218053@lists.php.net to get a copy of this message | ||
Note Submitter: ej at campbell dot name
----
You don't need exceptions to figure out if a class can be autoloaded. This is much simpler.
<?php
//Define autoloader
function __autoload($className) {
if (file_exists($className . '.php')) {
require_once $className . '.php';
return true;
}
return false;
}
function canClassBeAutloaded($className) {
return class_exists($className);
}
?>