Last active
May 3, 2018 16:01
-
-
Save nicolasegp/6d11c4f9cf28af0f2474881ed382ddee to your computer and use it in GitHub Desktop.
https://www.php-fig.org | PSR-1, PSR-4
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 | |
/** | |
* https://www.php-fig.org | PSR-1 , PSR-4 | |
*/ | |
spl_autoload_register(function ($Class) { | |
$Class = ltrim($Class, '\\'); | |
$_P = explode('\\', $Class); | |
$_P[] = str_replace('_', DIRECTORY_SEPARATOR, array_pop($_P)); | |
$Class = implode(DIRECTORY_SEPARATOR, $_P).'.php'; | |
unset($_P); | |
if(is_file($Class) && is_readable($Class)) { | |
require $Class; | |
return true; | |
} | |
return false; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment