How to delete file in PHP:
In this article,I will explain how to delete file using php unlink function with sample example.

unlink: Deletes a file


Example:
you can use this script to delete file.
<?php
$filename = "testfile.txt";
unlink($filename);
?>

Example:
<?php
$file = fopen('test.txt', 'a');
fwrite($file, 'how to delete file');
fclose($file);
unlink('test.txt');//delete test.txt file.
?>