Advertisement
Guest User

How NOT to Autoload in PHP

a guest
Jun 16th, 2017
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.36 KB | None | 0 0
  1. public static function includeDirectory($dir){
  2.     foreach (scandir($dir) as $entry){
  3.         if($entry == "." or $entry == "..")
  4.             continue;
  5.         // Recursively run functions on subdirectories.
  6.         elseif(is_dir("$dir/$entry"))
  7.             self::includeDirectory("$dir/$entry");
  8.         // Include .php files.
  9.         elseif(strrchr($entry, ".") == ".php")
  10.             include_once "$dir/$entry";
  11.     }
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement