note 77202 deleted from function.readdir by peehaa
| From: | peehaa@php.net | Date: | Fri, 19 May 2017 12:55:50 +0000 |
| Subject: | note 77202 deleted from function.readdir by peehaa | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-209073@lists.php.net to get a copy of this message | ||
Note Submitter: nullbyte at hotmail dot com
----
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);
?>