#Delete or create any extension type file(html, php, jpg, gif, flv, swf, etc...) #https://codepad.co/snippet/6a61c8 // Delete any extension type file(html, php, jpg, gif, flv, swf, etc...) <?php $file_x = "my_file.txt"; if (file_exists($file_x)) { unlink($file_x); // delete it here only if it exists echo "The file has been deleted"; } else { echo "The file was not found and could not be deleted"; } ?> // create any extension type file(html, php, xml, etc...) <?php $file_x = "my_file.txt"; $createFile = touch($file_x); if (file_exists($file_x)) { echo "The file has been created"; } else { echo "The file has not been created"; } ?>