Skip to content

Instantly share code, notes, and snippets.

@RyanNielson
Created March 24, 2014 12:20
Show Gist options
  • Save RyanNielson/9739104 to your computer and use it in GitHub Desktop.
Save RyanNielson/9739104 to your computer and use it in GitHub Desktop.
Function to recursively remove a directory and all of its contents.
function rrmdir($dir) {
foreach(glob($dir . '/*') as $file) {
if(is_dir($file))
$this->rrmdir($file);
else
unlink($file);
}
rmdir($dir);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment