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