Last active
April 7, 2017 13:17
-
-
Save mepawan/b538ca8a6e5849ae8c40e579dbc89f47 to your computer and use it in GitHub Desktop.
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 | |
function _require_all($directory, $exclude_folders = array(), $exclude_extensions = array() ) { | |
if(is_dir($directory)) { | |
$scan = scandir($directory); | |
unset($scan[0], $scan[1]); //unset . and .. | |
foreach($scan as $file) { | |
if(is_dir($directory."/".$file)) { | |
if(in_array($file,$exclude_folders)){ | |
continue; | |
} | |
_require_all($directory."/".$file); | |
} else { | |
if(in_array($ext, $exclude_extensions){ | |
continue; | |
} | |
include_once($directory."/".$file); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Php code to all include recursively inside given directory