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!