Curriculum
Course: PHP Basic
Login

Curriculum

PHP Basic

PHP Install

0/1

PHP Casting

0/1

PHP Constants

0/1

PHP Magic Constants

0/1

PHP Operators

0/1

PHP Reference

0/276
Text lesson

rmdir()

Example

Delete the “images” directory.

<?php
$path = “images”;
if(!rmdir($path)) {
  echo (“Could not remove $path”);
}
?>

Definition and Usage

The rmdir() function deletes an empty directory.

Syntax

rmdir(dircontext)

Parameter Values

Parameter

Description

dir

Required. Specifies the path of the directory to be deleted.

context

Optional. Specifies the context for the file handle, which consists of options that can alter the behavior of the stream.

Technical Details

Return Value:

Returns TRUE on success, FALSE on failure.

PHP Version:

4.0+