Created
December 21, 2011 11:14
-
-
Save gitmasta/1505666 to your computer and use it in GitHub Desktop.
autoload.php
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 __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