Skip to content

Instantly share code, notes, and snippets.

@darookee
Created October 11, 2012 09:04
Show Gist options
  • Select an option

  • Save darookee/3871140 to your computer and use it in GitHub Desktop.

Select an option

Save darookee/3871140 to your computer and use it in GitHub Desktop.
simple stupid autoloader function
<?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