Voting

: seven plus one?
(Example: nine)

The Note You're Voting On

jasoneisen at gee mail
16 years ago
An even better (PHP 5 only) alternative to "Davy Defaud's function":

<?php
function is_empty_dir($dir)
{
if ((
$files = @scandir($dir)) && count($files) <= 2) {
return
true;
}
return
false;
}
?>

NOTE: you should obviously be checking beforehand if $dir is actually a directory, and that it is readable, as only relying on this you would assume that in both cases you have a non-empty readable directory.

<< Back to user notes page

To Top