public function regExpFile($regExp, $dir) { $open = opendir($dir); $matches = array(); while (($file = readdir($open)) !== false) { if (preg_match($regExp, $file, $matches)) { return $matches; } } return false; }