This example show how to create and delete files using the function touch and unlink function.

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Creating a pfile with touch</title>
</head>
<body text="#000080" bgcolor="#F7F0D7">
<?php
//unlink_touch_file.php
$file ="create_touch.txt";
if(file_exists($file)) { echo "file $file exists <br/>"; }
if(file_exists($file)) { echo "file $file is unlinked <br>";unlink($file); }
if(file_exists($file)) { echo "file $file exists <br/>"; }
else { echo "file $file does not exists<br/>"; }
if(!file_exists($file)) { touch($file); echo "file $file created with touch<br/>"; }
else { echo "file $file does not exists <br/>"; }
?>
</body>

</html>
 

running for the first time

ran again