note 13671 added to function.is-dir.php
| From: | haydn at sun dot com | Date: | Thu, 28 Jun 2001 11:38:45 +0000 |
| Subject: | note 13671 added to function.is-dir.php | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-14713@lists.php.net to get a copy of this message | ||
is_dir wouldn't work with anything suggested above. Using opendir('.') was the only
working method. This method will allow relative or full paths.
See below for example:
chdir('../path/to/examine');
$dir = opendir('.');
while (($file = readdir($dir)) !==false) {
if ($file != '.' && $file != '..' &&
!is_dir("$file")) {
echo "$file\n";
}
}
Details:
--------
OS: SunOS 5.8 SPARC (solaris 8)
PHP: 4.0.5
APACHE: 1.3.20
http://www.php.net/manual/en/function.is-dir.php