PHP rmdir() Function

Definition

The rmdir() function removes an empty directory.

Syntax

rmdir(dir,context)

Parameter

ParameterIs requiredDescription
dirRequired.Directory to be removed
contextOptional.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");
}
?>




















Home »
  PHP Tutorial »
    Function reference »




PHP Array Functions
PHP Calendar Functions
PHP Class Functions
PHP Data Type Functions
PHP Date Functions
PHP File Functions
PHP Image Functions
PHP Math Functions
PHP MySQLi Functions
PHP SimpleXML Functions
PHP String Functions
PHP XML Functions
PHP Zip Functions