note 37096 deleted from function.opendir by didou
| From: | didou@php.net | Date: | Mon, 03 Nov 2003 07:26:21 +0000 |
| Subject: | note 37096 deleted from function.opendir by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-59674@lists.php.net to get a copy of this message | ||
Note Submitter: d@spyfx.com
----
I had some problems with example 1, and noticed that the filetype($dir.$file) produced errors. The
corrected functional code is as follows(I simply added a / to provide the correct full path):
<?php
$dir = "/tmp/";
// Open a known directory, and proceed to read its contents
if (is_dir($dir)) {
if ($dh = opendir($dir)) {
while (($file = readdir($dh)) !== false) {
print "filename: $file : filetype: " . filetype($dir .'/'. $file) .
"\n";
}
closedir($dh);
}
}
?>