- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
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!
- Related Articles
- PHP: Unlink All Files Within A Directory, and then Deleting That Directory
- strcmp() function in PHP
- strcoll() function in PHP
- strcspn() function in PHP
- strip_tags() function in PHP
- stripcslashes() function in PHP
- stripos() function in PHP()
- stristr() function in PHP
- stripslashes() function in PHP
- strlen() function in PHP
- strnatcasecmp() function in PHP
- strnatcmp() function in PHP
- strncasecmp() function in PHP
- strncmp() function in PHP
- strpbrk() function in PHP

Advertisements