note 23720 added to function.readdir
| From: | ef at globexchange dot com | Date: | Thu, 25 Jul 2002 18:31:02 +0000 |
| Subject: | note 23720 added to function.readdir | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-33563@lists.php.net to get a copy of this message | ||
I have to count if a directory has sub-directories or not...
This works for files...
<?php
$count = 0;
if ($handle = opendir('.')) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
$count = $count +1;
}
}
closedir($handle);
}
if ($count > 0) { echo "Has files"; }
How do I do this to see if we have sub-directories?
?>
--
http://www.php.net/manual/en/function.readdir.php
http://master.php.net/manage/user-notes.php?action=edit+23720
http://master.php.net/manage/user-notes.php?action=delete+23720
http://master.php.net/manage/user-notes.php?action=reject+23720