note 77202 modified in function.readdir by danbrown
| From: | danbrown@php.net | Date: | Thu, 25 Feb 2010 20:31:21 +0000 |
| Subject: | note 77202 modified in function.readdir by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-166368@lists.php.net to get a copy of this message | ||
I haven't tested this yet, but it seems like it'll do just fine if you need files of a
certain extension:
<?php
$dh = opendir($options['inputDir']);
$files = array();
while (($filename = readdir($dh)) !== false)
{
if (substr($filename, strrpos($filename, '.')) == $options['inputExt'])
{
$files[] = $filename;
}
}
closedir($dh);
?>
--was--
I haven't tested this yet, but it seems like it'll do just fine if you need files of a
certain extension:
$dh = opendir($options['inputDir']);
$files = array();
while (($filename = readdir($dh)) !== false)
{
if (substr($filename, strrpos($filename, '.')) == $options['inputExt'])
{
$files[] = $filename;
}
}
closedir($dh);
http://php.net/manual/en/function.readdir.php