<?phpfunction cleanup_directory($dir) {foreach (new DirectoryIterator($dir) as $file) {if ($file->isDir()) {if (! $file->isDot()) {cleanup_directory($file->getPathname());}} else {unlink($file->getPathname());}}rmdir($dir);}?>