Skip to content

Instantly share code, notes, and snippets.

@domenicomonaco
Created May 11, 2009 21:46
Show Gist options
  • Save domenicomonaco/110205 to your computer and use it in GitHub Desktop.
Save domenicomonaco/110205 to your computer and use it in GitHub Desktop.
<?php
//simple example of recursive require and read *.ext of files
$dir = "./path_file/"; //Set dir
$dh = opendir($dir);
while (($file = readdir($dh)) !== false) {
$fExt= end(explode(".", $file));
if ($fExt=='php'){ //if ext of file is php or other *.ext
$rFile[]=$file; //add file to array
}
}
closedir($dh);
// recursive inlcuding of file of array
for ($d=0;$d<$dmax=(sizeof($rFile));$d++){
require ($dir.$rFile[$d]);
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment