Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- spl_autoload_register(
- function($className) {
- $fileParts = explode('\\', ltrim($className, '\\'));
- if (false !== strpos(end($fileParts), '_'))
- array_splice($fileParts, -1, 1, explode('_', current($fileParts)));
- $file = implode(DIRECTORY_SEPARATOR, $fileParts) . '.php';
- foreach (explode(PATH_SEPARATOR, get_include_path()) as $path) {
- if (file_exists($path = $path . DIRECTORY_SEPARATOR . $file))
- return require $path;
- }
- }
- );
Add Comment
Please, Sign In to add comment