How to use rmdir in PHP

In this article I am going to explain about rmdir function in PHP.
  • 1283

PHP rmdir() Function

The filesystem rmdir removes an empty directory. The rmdir function returns true on success or false on failure.

Syntax of rmdir function

rmdir(dir, context)

Parameters in rmdir function

It have two parameter:

Parameter Description
dir It specifies the directory to be removed.
context It specifies the context of the file handle.

Example of filesystem rmdir function

<html>

<body>

<?php

if(!is_dir("MCN Solution"))

{

mkdir("MCN Solution");           // It directory not exists then it creates a directory.

}

else

{

rmdir("MCN Solution");

echo "Directory Deleted!";

}

?>

</body>

</html>


Output:

rmdir-php.jpg

You may also want to read these related articles :
here

Ask Your Question 

Got a programming related question? You may want to post your question here

Programming Answers here

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.