- 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
unlink() function in PHP
The unlink() function deletes a file. It returns TRUE on success, or FALSE on failure. It returns TRUE on success and FALSE on failure.
Syntax
unlink(file_path, context)
Parameters
file_path − Set the name of the file to be deleted.
context − Set the behavior of the stream.
Return
The unlink() function returns TRUE on success and FALSE on failure.
Example
<?php $file_pointer = "one.txt"; if (!unlink($file_pointer)) { echo ("File can’t be deleted!"); } else { echo ("File deleted!"); } ?>
Output
File can’t be deleted!
Advertisements