Find all files with specific extensions in directroy and subdirectories
<?php
$extension = 'php';
$dir = new RecursiveDirectoryIterator('folder');
foreach (new RecursiveIteratorIterator($dir) as $filename => $file) {
if ($file->isFile() && $file->getExtension() == $extension) {
echo $file->getPathname() . "<br />";
}
}
?>