Guest User

Untitled

a guest
Jul 22nd, 2018
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. <?php
  2.  
  3. spl_autoload_register(
  4. function($className) {
  5. $fileParts = explode('\\', ltrim($className, '\\'));
  6.  
  7. if (false !== strpos(end($fileParts), '_'))
  8. array_splice($fileParts, -1, 1, explode('_', current($fileParts)));
  9.  
  10. $file = implode(DIRECTORY_SEPARATOR, $fileParts) . '.php';
  11.  
  12. foreach (explode(PATH_SEPARATOR, get_include_path()) as $path) {
  13. if (file_exists($path = $path . DIRECTORY_SEPARATOR . $file))
  14. return require $path;
  15. }
  16. }
  17. );
Add Comment
Please, Sign In to add comment