How to delete file from a PHP folder


How to delete file from a folder PHP
This program uses unlink() function to remove file from directory.
<?php
/* PHP program to delete a file data.txt */
/* using unlike() function  */
   
$file= "data.txt";  
   
/* Use unlink() function to delete a file  */
if (!unlink($file_pointer)) {  
    echo ("$file delete error");  
}  
else {  
    echo ("$file deleted successfully !");  
}  
 
?>