note 82860 added to language.oop5.autoload
| From: | ChrisContinanza at osu1 dot php dot net | Date: | Tue, 29 Apr 2008 18:43:08 +0000 |
| Subject: | note 82860 added to language.oop5.autoload | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-138909@lists.php.net to get a copy of this message | ||
Decided to warm up to autoload,
but wanted it to use the include_path.
Good default behavior.
function __autoload($class_name) {
$include_path = get_include_path();
$include_path_tokens = explode(':', $include_path);
foreach($include_path_tokens as $prefix){
$path = $prefix . '/' . $class_name . '.php';
if(file_exists($path)){
require_once $path;
return;
}
}
}
----
Server IP: 209.41.74.194
Probable Submitter: 76.124.160.90
----
Manual Page -- http://www.php.net/manual/en/language.oop5.autoload.php
Edit -- https://master.php.net/note/edit/82860
Del: integrated -- https://master.php.net/note/delete/82860/integrated
Del: useless -- https://master.php.net/note/delete/82860/useless
Del: bad code -- https://master.php.net/note/delete/82860/bad+code
Del: spam -- https://master.php.net/note/delete/82860/spam
Del: non-english -- https://master.php.net/note/delete/82860/non-english
Del: in docs -- https://master.php.net/note/delete/82860/in+docs
Del: other reasons-- https://master.php.net/note/delete/82860
Reject -- https://master.php.net/note/reject/82860
Search -- https://master.php.net/manage/user-notes.php