note 97140 added to language.oop5.autoload
| From: | ej at campbell dot name | Date: | Sat, 03 Apr 2010 19:21:41 +0000 |
| Subject: | note 97140 added to language.oop5.autoload | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-167677@lists.php.net to get a copy of this message | ||
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);
}
----
Server IP: 69.147.83.197
Probable Submitter: 209.131.62.115
----
Manual Page -- http://www.php.net/manual/en/language.oop5.autoload.php
Edit -- https://master.php.net/note/edit/97140
Del: integrated -- https://master.php.net/note/delete/97140/integrated
Del: useless -- https://master.php.net/note/delete/97140/useless
Del: bad code -- https://master.php.net/note/delete/97140/bad+code
Del: spam -- https://master.php.net/note/delete/97140/spam
Del: non-english -- https://master.php.net/note/delete/97140/non-english
Del: in docs -- https://master.php.net/note/delete/97140/in+docs
Del: other reasons-- https://master.php.net/note/delete/97140
Reject -- https://master.php.net/note/reject/97140
Search -- https://master.php.net/manage/user-notes.php