The rmdir() function removes an empty directory.
rmdir(dir,context)
Parameter | Is required | Description |
---|---|---|
dir | Required. | Directory to be removed |
context | Optional. | Context of the file handle. |
This function returns TRUE on success, or FALSE on failure.
PHP rmdir() takes a directory name and deletes the specified directory. The directory must be empty; otherwise, the call will fail.
<?php
$path = "images";
if(!rmdir($path)){
echo ("Could not remove $path");
}
?>