Skip to content

Instantly share code, notes, and snippets.

@syads321
Created October 9, 2015 03:24
Show Gist options
  • Save syads321/f23d8ac5bc2a6a39e3a3 to your computer and use it in GitHub Desktop.
Save syads321/f23d8ac5bc2a6a39e3a3 to your computer and use it in GitHub Desktop.
Php Delete folder
function Delete($path)
{
if (is_dir($path) === true)
{
$files = array_diff(scandir($path), array('.', '..'));
foreach ($files as $file)
{
Delete(realpath($path) . '/' . $file);
}
return rmdir($path);
}
else if (is_file($path) === true)
{
return unlink($path);
}
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment