Skip to content

Instantly share code, notes, and snippets.

@gitmasta
Created December 21, 2011 11:14
Show Gist options
  • Save gitmasta/1505666 to your computer and use it in GitHub Desktop.
Save gitmasta/1505666 to your computer and use it in GitHub Desktop.
autoload.php
<?php function __autoload($class_name) {
if(class_exists($class_name))
return new $class_name();
else if(file_exists("app/$class_name.class.php"))
{
include_once "app/$class_name.class.php";
return new $class_name();
}
else throw new Exception("Class not found.");
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment