Created
May 21, 2012 22:34
-
-
Save Fivell/2765125 to your computer and use it in GitHub Desktop.
php 5.3 autoload lambdA
This file contains 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 | |
spl_autoload_register(function($className) | |
{ | |
$fileName = str_replace('\\', '/', ltrim($className, '\\')) . '.php'; | |
if (file_exists($fileName)){ | |
require $fileName; | |
return class_exists($className, false); | |
} | |
return false; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment