note 9939 added to readdir
| From: | aozturk at php2 dot chek dot com | Date: | Sat, 02 Dec 2000 23:05:34 +0000 |
| Subject: | note 9939 added to readdir | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-8350@lists.php.net to get a copy of this message | ||
// You can push all files in a
// directory into a array with opendir
// and array_push functions.
// This example for pushing all .jpg
// files in $dizin directory into
// $imagelist array.
function imagelist($dizin)
{
$imagelist=array();
$handle=opendir("$dizin");
while ($filename = readdir($handle))
{
if ($file != "." && $file != "..") {
$ext=substr($filename,-4);
if ($ext == ".jpg") {
$file=substr($filename,0,-4);
array_push($imagelist, "$file");
}
}
}
}
http://www.php.net/manual/function.readdir.php