note 124202 rejected from language.oop5.autoload by cmb
| From: | cmb@php.net | Date: | Tue, 17 Sep 2019 06:31:46 +0000 |
| Subject: | note 124202 rejected from language.oop5.autoload by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-212238@lists.php.net to get a copy of this message | ||
Note Submitter: rafehahmad99 at gmail dot com
----
can somebody help me to change the __autoload() to spl_autoload_register()
function __autoload($class) {
$class = strtolower($class);
//if call from within assets adjust the path
$classpath = 'classes/class.'.$class . '.php';
if ( file_exists($classpath)) {
require_once $classpath;
}
//if call from within admin adjust the path
$classpath = '../classes/class.'.$class . '.php';
if ( file_exists($classpath)) {
require_once $classpath;
}
//if call from within admin adjust the path
$classpath = '../../classes/class.'.$class . '.php';
if ( file_exists($classpath)) {
require_once $classpath;
}
}