Skip to content

Instantly share code, notes, and snippets.

@SimonDevelop
Created September 24, 2019 14:01
Show Gist options
  • Save SimonDevelop/2a7637fd65724cae4a95436de2b0e5d0 to your computer and use it in GitHub Desktop.
Save SimonDevelop/2a7637fd65724cae4a95436de2b0e5d0 to your computer and use it in GitHub Desktop.
is_dir_empty php function
<?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