public static function getFilesRecursivelyWithSpecifiedExtension($dir, $extension)
    {
        $directory = new RecursiveDirectoryIterator($dir);
        $iterator = new RecursiveIteratorIterator($directory);
        $filter = new RegexIterator($iterator, "/\.$extension$/i", RecursiveRegexIterator::GET_MATCH);
        return array_keys(iterator_to_array($filter));
    }
public static function getFilesRecursivelyWithSpecifiedExtension($dir, $extension)
    {
        $directory = new RecursiveDirectoryIterator($dir);
        $iterator = new RecursiveIteratorIterator($directory);
        $filter = new RegexIterator($iterator, "/\.$extension$/i", RecursiveRegexIterator::GET_MATCH);
        return array_keys(iterator_to_array($filter));
    }
public static function getFilesRecursivelyWithSpecifiedExtension ( $ dir , $ extension ) { $ directory = new RecursiveDirectoryIterator ( $ dir ) ; $ iterator = new RecursiveIteratorIterator ( $ directory ) ; $ filter = new RegexIterator ( $ iterator , "/\.$extension$/i" , RecursiveRegexIterator :: GET_MATCH ) ; return array_keys ( iterator_to_array ( $ filter ) ) ; }
Returns all files from the given directory that have the given extension.

@param string $dir
@param string $extension
@return array
Returns all files from the given directory that have the given extension .