Here is another way to test if a directory is empty, which I think is much simpler than those posted below:
<?php
$dir = 'directory';
echo (count(glob("$dir/*")) === 0) ? 'Empty' : 'Not empty';
?>
Here is another way to test if a directory is empty, which I think is much simpler than those posted below:
<?php
$dir = 'directory';
echo (count(glob("$dir/*")) === 0) ? 'Empty' : 'Not empty';
?>