public static function loadGlobal() { if (!empty(self::$directories)) { foreach (self::$directories as $directory) { $handle = opendir(APPROOT . DS . $directory . DS); while (false !== ($entry = readdir($handle))) { if ($entry != '.' && $entry != '..' && $entry != '.php') { require APPROOT . DS . $directory . DS . $entry; } } } } self::$directories = array(); }
<?php require_once 'autoloader_test.php'; spl_autoload_register(array('AutoloaderTest', 'loadtest')); AutoloaderTest::loadGlobal();