Created
October 11, 2012 09:04
-
-
Save darookee/3871140 to your computer and use it in GitHub Desktop.
simple stupid autoloader function
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function loadClasses($dir) { | |
| $d = new \DirectoryIterator($dir); | |
| while($d->valid()) { | |
| $f = $d->current(); | |
| if($f->getExtension() == 'php') { | |
| include $f->getPathname(); | |
| } elseif($f->isDir()&&!$f->isDot()) { | |
| loadClasses($f->getPathname()); | |
| } | |
| $f->next(); | |
| } | |
| unset($d); | |
| } | |
| loadClasses($classPath); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment