note 82719 modified in function.is-dir by felipe
| From: | felipe@php.net | Date: | Wed, 23 Apr 2008 16:29:30 +0000 |
| Subject: | note 82719 modified in function.is-dir by felipe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-138703@lists.php.net to get a copy of this message | ||
I altered the function below a bit. This implementation is simpler, faster and safer:
<?php
function is_empty_folder($folder) {
if (! is_dir($folder))
return false; // not a dir
$files = opendir($folder);
while ($file = readdir($files)) {
if ($file != '.' && $file != '..')
return true; // not empty
}
}
?>
--was--
I altered the function below a bit. This implementation is simpler, faster and safer:
<?php
function is_empty_folder($folder) {
if (! is_dir($folder))
return false; // not a dir
$files = opendir($folder);
while ($file = readdir($files)) {
if ($file != '.' && $file != '..')
return false; // not empty
}
}
?>
http://php.net/manual/en/function.is-dir.php