Code: Select all
private static function getFiles($path, $match){
$dirs = glob($path . "*");
$files = glob($path . "*" . $match);
foreach($files as $file)
{
if(is_file($file))
{
$name = str_replace(".php", "", basename($file));
self::$files[$name] = $file;
}
}
foreach($dirs as $dir)
{
if(is_dir($dir))
{
$dir = basename($dir) . "/";
self::getFiles($path . $dir, $match);
}
}
}While it does work, it seems a bit too bulky and I'm not sure why. Not to mention I've heard glob is a bit slower and should not be used when looping through an entire file structure. So can anyone give some tips on how to fix this up or some examples that don't use glob? Thanks