note 37461 added to function.readdir
| From: | jackylee at eml dot cc | Date: | Sun, 16 Nov 2003 03:42:49 +0000 |
| Subject: | note 37461 added to function.readdir | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-60446@lists.php.net to get a copy of this message | ||
// 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);
?>
----
Manual Page -- http://www.php.net/manual/en/function.readdir.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+37461
Delete -- http://master.php.net/manage/user-notes.php?action=delete+37461&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+37461&report=yes
Search -- http://master.php.net/manage/user-notes.php