note 37461 deleted from function.readdir by tomsommer
| From: | tomsommer@php.net | Date: | Sun, 27 Jun 2004 13:12:38 +0000 |
| Subject: | note 37461 deleted from function.readdir by tomsommer | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-71881@lists.php.net to get a copy of this message | ||
Note Submitter: jackylee@eml.cc
----
// enough to add all file names of a subdirectory into an array.
// hope this can save your time :-)
<?php
$handle=opendir('wallpaper');
$tempbackground = array(""); // i don't use $tempbackground[0]
$addone = 1;
while (false!==($file = readdir($handle)))
{
if ($file != "." && $file != "..")
{
$tempbackground[$addone] = "wallpaper/$file";
$addone = $addone + 1;
}
}
closedir($handle);
?>