note 75476 modified in function.readdir by danbrown
| From: | danbrown@php.net | Date: | Thu, 25 Feb 2010 20:28:53 +0000 |
| Subject: | note 75476 modified in function.readdir by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-166364@lists.php.net to get a copy of this message | ||
If you want to list only a certain filetype, this case only jpg and gif files in an image directory
<?php
$dir = opendir ("../images");
while (false !== ($file = readdir($dir))) {
if (strpos($file, '.gif',1)||strpos($file, '.jpg',1) ) {
echo "$file <br />";
}
}
?>
--was--
If you want to list only a certain filetype, this case only jpg and gif files in an image directory
$dir = opendir ("../images");
while (false !== ($file = readdir($dir))) {
if (strpos($file, '.gif',1)||strpos($file, '.jpg',1) ) {
echo "$file <br />";
}
}
http://php.net/manual/en/function.readdir.php