note 59072 deleted from function.readdir by tularis
| From: | tularis@php.net | Date: | Sun, 13 May 2007 19:02:05 +0000 |
| Subject: | note 59072 deleted from function.readdir by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-126522@lists.php.net to get a copy of this message | ||
Note Submitter: Martin dot Grossberger at andtek dot com
----
to ES:
i believe you are mistaken. readdir() returns a string (the filename), not an array
therefor, the open_dir function should be like this:
function open_dir($dir) {
$this->dir = $dir;
$handle = opendir($this->dir);
if($handle) {
while(false !== ($file = readdir($handle)) {
if($file != "." && $file != "..") {
$files[] = $file;
}
}
sort($files);
foreach($files as $file) {
echo $file."<br>";
}
}
}