note 35638 added to ref.filesystem
| From: | curlee at mindspring dot com | Date: | Tue, 09 Sep 2003 13:23:41 +0000 |
| Subject: | note 35638 added to ref.filesystem | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-55884@lists.php.net to get a copy of this message | ||
Here is quick way to read a dir listing into an array (this is helpfull when you want to walk
through a dir file-by-file)
Here is the code:
// Load up array with file names!
$handle = opendir(/path/to/your/dir);
$array_indx = 0;
while (false !== ($file = readdir($handle)))
{
$dir_array[$array_indx] = $file;
$array_indx ++;
}
foreach ($dir_array as $n)
{
// put your per-file code here
// example: print "<br>Filename: ".$n."<br>";
}
----
Manual Page -- http://www.php.net/manual/en/ref.filesystem.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+35638
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+35638&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+35638&report=yes