note 81990 deleted from function.is-dir by nlopess
| From: | nlopess@php.net | Date: | Sun, 23 Mar 2008 00:15:05 +0000 |
| Subject: | note 81990 deleted from function.is-dir by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-137332@lists.php.net to get a copy of this message | ||
Note Submitter: Khez
----
This is better and in the case that the folder is not empty, faster...
<?php
function is_empty_folder($folder){
if(is_dir($folder) ){
$c=0;
$files=opendir($folder);
while ($file=readdir($files)) {
$c++;
if ($c>2)
break;
}
if ($c>2) {
return false;
} else {
return true;
}
}
return NULL;
}
?>