public function autoload()
    {
        spl_autoload_register(function($className)
        {
            $className = str_replace("\\", DS, $className);
            $classNameOnly = basename($className);
            $namespace = substr($className, 0, -strlen($classNameOnly));
            if (is_file($class = BASE_PATH . "{$className}.php")) {
                return include_once($class);
            } elseif (is_file($class = BASE_PATH . strtolower($namespace). $classNameOnly . '.php')) {
                return include_once($class);
            } elseif (is_file($class = BASE_PATH . strtolower($className).'.php')) {
                return include_once($class);
            } elseif (is_file($class = BASE_PATH . $namespace . lcfirst($classNameOnly) . '.php')) {
                return include_once($class);
            }elseif (is_file($class = BASE_PATH . strtolower($namespace) . lcfirst($classNameOnly) . '.php')) {
                return include_once($class);
            }
            return false;
        });
    }
public function autoload()
    {
        spl_autoload_register(function($className)
        {
            $className = str_replace("\\", DS, $className);
            $classNameOnly = basename($className);
            $namespace = substr($className, 0, -strlen($classNameOnly));
            if (is_file($class = BASE_PATH . "{$className}.php")) {
                return include_once($class);
            } elseif (is_file($class = BASE_PATH . strtolower($namespace). $classNameOnly . '.php')) {
                return include_once($class);
            } elseif (is_file($class = BASE_PATH . strtolower($className).'.php')) {
                return include_once($class);
            } elseif (is_file($class = BASE_PATH . $namespace . lcfirst($classNameOnly) . '.php')) {
                return include_once($class);
            }elseif (is_file($class = BASE_PATH . strtolower($namespace) . lcfirst($classNameOnly) . '.php')) {
                return include_once($class);
            }
            return false;
        });
    }
public function autoload ( ) { spl_autoload_register ( function ( $ className ) { $ className = str_replace ( "\\" , DS , $ className ) ; $ classNameOnly = basename ( $ className ) ; $ namespace = substr ( $ className , 0 , - strlen ( $ classNameOnly ) ) ; if ( is_file ( $ class = BASE_PATH . "{$className}.php" ) ) { return include_once ( $ class ) ; } elseif ( is_file ( $ class = BASE_PATH . strtolower ( $ namespace ) . $ classNameOnly . '.php' ) ) { return include_once ( $ class ) ; } elseif ( is_file ( $ class = BASE_PATH . strtolower ( $ className ) . '.php' ) ) { return include_once ( $ class ) ; } elseif ( is_file ( $ class = BASE_PATH . $ namespace . lcfirst ( $ classNameOnly ) . '.php' ) ) { return include_once ( $ class ) ; } elseif ( is_file ( $ class = BASE_PATH . strtolower ( $ namespace ) . lcfirst ( $ classNameOnly ) . '.php' ) ) { return include_once ( $ class ) ; } return false ; } ) ; }
Magic autoload.
Magic autoload .