The
rmdir() filesystem function in PHP will remove or delete a directory, only if the folder is empty. You may also want to be sure that the target file is in fact a directory before removing it by using the
is_dir() function.
<?php
$target = "myFolder";
if (is_dir($target)) {
rmdir($target); // Remove it now
}
?>