File Directory Php

function DELETE_RECURSIVE_DIRS($dirname)
{ // recursive function to delete
// all subdirectories and contents:
if(is_dir($dirname))$dir_handle=opendir($dirname);
while($file=readdir($dir_handle))
{
if($file!="." && $file!="..")
{
if(!is_dir($dirname."/".$file))unlink ($dirname."/".$file);
else DELETE_RECURSIVE_DIRS($dirname."/".$file);
}
}
closedir($dir_handle);
rmdir($dirname);
return true;
}