• PHP Video Tutorials

PHP - Function rmdir()



The rmdir() function can remove an empty directory, and return true on success, or false on failure.

Syntax

bool rmdir ( string $dirname [, resource $context ] )

This function can attempt to remove the directory named by dirname. The directory must be empty, and relevant permissions must permit this. An E_WARNING level error can be generated on failure.

Example

<?php
   if(!is_dir("/PhpProject/examples")) {
      mkdir("/PhpProject/examples");
   }

   rmdir("/PhpProject/examples");
   echo "Directory removed successfully!!!";
?>

Output

Directory removed successfully!!!
php_function_reference.htm
Advertisements