Last active
January 5, 2018 15:12
-
-
Save toledorobia/7a0ab415780d6bf9615d3bb7f2a6938e to your computer and use it in GitHub Desktop.
PHP - Check dir is empty
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function is_dir_empty($dir) { | |
if (!is_readable($dir)) { | |
return null; | |
} | |
return (count(scandir($dir)) == 2); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment