unlink () function to delete files.
If successful, the function returns TRUE. If it fails, FALSE is returned.
<?php $file = "test.txt"; if (!unlink($file)) { echo ("Error deleting $file"); } else { echo ("Deleted $file"); } ?>
reference:
https://www.runoob.com/php/func-filesystem-unlink.html