note 93081 deleted from function.opendir by danbrown
| From: | danbrown@php.net | Date: | Sat, 22 Aug 2009 01:26:14 +0000 |
| Subject: | note 93081 deleted from function.opendir by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-159778@lists.php.net to get a copy of this message | ||
Note Submitter: ferodano at gmail dot com
----
To exclude all files beginning with a dot, a simple regular expression match would do the job:
$dir = "DIR/";
if (is_dir($dir)) {
if ($dh = opendir($dir)) {
while (($file = readdir($dh)) !== false) {
if(preg_match('/^\./', $file )) {
continue;
}
echo $file . "<br>";
}
closedir($dh);
}
}