public function rsearch($folder, $pattern)
    {
        $dir      = new RecursiveDirectoryIterator($folder);
        $iterator = new RecursiveIteratorIterator($dir);
        $files    = new RegexIterator($iterator, $pattern, RegexIterator::GET_MATCH);
        $fileList = [];

        foreach ($files as $file) {
            $fileList = array_merge($fileList, $file);
        }

        return $fileList;
    }
public function rsearch($folder, $pattern)
    {
        $dir      = new RecursiveDirectoryIterator($folder);
        $iterator = new RecursiveIteratorIterator($dir);
        $files    = new RegexIterator($iterator, $pattern, RegexIterator::GET_MATCH);
        $fileList = [];

        foreach ($files as $file) {
            $fileList = array_merge($fileList, $file);
        }

        return $fileList;
    }
public function rsearch ( $ folder , $ pattern ) { $ dir = new RecursiveDirectoryIterator ( $ folder ) ; $ iterator = new RecursiveIteratorIterator ( $ dir ) ; $ files = new RegexIterator ( $ iterator , $ pattern , RegexIterator :: GET_MATCH ) ; $ fileList = [ ] ; foreach ( $ files as $ file ) { $ fileList = array_merge ( $ fileList , $ file ) ; } return $ fileList ; }
Search the given folder recursively for files using
a regular expression pattern.

@param  string  $folder
@param  string  $pattern
@return array
Search the given folder recursively for files using a regular expression pattern .