How to delete entire directory which is not empty in PHP


In PHP to delete a file we use unlink() function, and to delete a directory we use rmdir() function but the directory has to be empty first Here is how to delete the entire directory whether it has files or not function delete_directory($path){ $d = dir($path); while($entry = $d->read()) { if ($entry!= "." && $entry!= … Continue reading How to delete entire directory which is not empty in PHP