Home >> Latest Articles >> How to Delete a file in PHP

How to Delete a file in PHP

How to Delete a file in PHP: PHP Delete File
Syntax: unlink(FILE_PATH);

Example: unlink(‘log.txt’);
Note: This function will return TRUE on success or FALSE on failure. In order for this to be successful, the following condition must be true.
  1. The file must be closed
  2. The web app must have write permission on the folder that contains the file.
You may also like - Core PHP Interview Questions
#Example

You may also like - Node js Interview Questions
Full Stack Tutorials

Author @FullStackTutorials | View all Articles