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.