function getPHPs($path) { $i = new RecursiveDirectoryIterator($path); $files = array(); foreach ($i as $f) { if ($f->isFile() && preg_match('/\\.php$/Ss', $f->getFilename())) { $files[] = $f->getPathname(); } elseif ($f->isDir()) { $tmp = getPHPs($f->getPathname()); if ($tmp) { $files = array_merge($files, $tmp); } } } return $files; }
function getPHPs($path) { $i = new RecursiveDirectoryIterator($path, FilesystemIterator::SKIP_DOTS); $files = array(); foreach ($i as $f) { if ($f->isFile() && preg_match('/\\.php$/Ss', $f->getFilename())) { $files[] = $f->getPathname(); } elseif ($f->isDir()) { //echo "Get directory: " .$f->getPathname() . PHP_EOL; $tmp = getPHPs($f->getPathname()); if ($tmp) { $files = array_merge($files, $tmp); } } } return $files; }