My autoloader function:
<?php
function __autoload( $class_name )
{
$invalidChars = array(
'.', '\\', '/', ':', '*', '?', '"', '<', '>', "'", '|'
);
$class_name = str_replace($invalidChars, '', $class_name);
$extension_prefix = '.class.php';
if( !@include_once $class_name . $extension_prefix )
{
$path = 'lib'; foreach( new DirectoryIterator($path) as $file )
{
if($file->isDot()) { continue; }
if($file->isDir())
{
$file = $path . DIRECTORY_SEPARATOR . $file->getFilename() . DIRECTORY_SEPARATOR . $class_name . $extension_prefix;
if(file_exists($file)) {
include_once $file;
}
}
}
}
if (!class_exists($class_name, false) || !interface_exists($class_name, false)) {
}
}
?>