how to delete a folder which is empty using PHP
<pre><code>&lt;?php 
function rmdirr($dirname){
 // Sanity check
 $dirname = "TEST/";
 if (!file_exists($dirname)) {
  return false;
 }

 // Simple delete for a file
 if (is_file($dirname)) {
  return unlink($dirname);
 }

 // Loop through the folder
 $dir = dir($dirname);
 while (false !== $entry = $dir-&gt;read()) {
  // Skip pointers
  if ($entry == "." || $entry == "..") {
   continue;
  }

  // Recurse
  unlink("$dirname/$entry");
 }

 // Clean up
 $dir-&gt;close();
 return rmdir($dirname);
}
if (rmdirr($_GET['map'])){
 echo "TEST FERo";
}
else{
 echo "something went wrong.";
}
?&gt;
</code></pre>

<p>Its working well and good. But if i need to delete the folder which contains some files and empty folder. In this case it delete all the files but not the empty folder. It throws an exception like…</p>

<pre><code>Warning: unlink(TEST//New Folder) [function.unlink]: Permission denied 
  in E:\Xampp\xampp\htdocs\delete_FILE\delete_FILE.php on line 23

Warning: rmdir(TEST/) [function.rmdir]: Directory not empty in
  E:\Xampp\xampp\htdocs\delete_FILE\delete_FILE.php on line 28
</code></pre>

<p>What is the possible way to delete even the folder is empty.</p>
