- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
rmdir() function in PHP
The rmdir() function removes an empty directory. With that, the file must have the relevant permissions required to delete the directory.
Syntax
rmdir(dir, context)
Parameters
rmdir − The directory to be removed.
context − Specify the behavior of the stream.
Return
The rmdir() function returns True on success or False on failure.
Example
<?php $file_path = "amit"; if(!rmdir($file_path)) { echo ("Could not remove $path"); } ?>
Output
TRUE
Let us see another example.
Example
<?php mkdir(‘documents); $dir= "documents"; // using rmdir() to remove directory rmdir($dir); ?>
Output
TRUE
Advertisements