note 82860 deleted from language.oop5.autoload by cmb
| From: | cmb@php.net | Date: | Tue, 05 Nov 2019 14:46:28 +0000 |
| Subject: | note 82860 deleted from language.oop5.autoload by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-212940@lists.php.net to get a copy of this message | ||
Note Submitter: Chris Continanza
----
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;
}
}
}