Created
September 24, 2019 14:01
-
-
Save SimonDevelop/2a7637fd65724cae4a95436de2b0e5d0 to your computer and use it in GitHub Desktop.
is_dir_empty php function
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; | |
} | |
$handle = opendir($dir); | |
while (false !== ($entry = readdir($handle))) { | |
if ($entry != "." && $entry != "..") { | |
return false; | |
} | |
} | |
return true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment