Skip to content

Instantly share code, notes, and snippets.

@ricardodantas
Created March 6, 2013 16:28
Show Gist options
  • Save ricardodantas/5100627 to your computer and use it in GitHub Desktop.
Save ricardodantas/5100627 to your computer and use it in GitHub Desktop.
Autoload function with "implements"
function __autoload($classe)
{
$diretorios = array('class', 'interface');
foreach ( $diretorios as $diretorio ) {
if ( file_exists($diretorio . '/' . $classe . '.php') ) {
require $diretorio . '/' . $classe . '.php';
break;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment