Search notes:

PHP: unlink

unlink($file) deletes a file or symlink.
<?php

$filename = 'xyz.txt';

if (rand(0,1)) {
   print("Touching $filename\n");
   touch($filename);
}

if (file_exists($filename)) {
   print("Deleting $filename\n");
   unlink($filename);
}

?>
Github repository about-php, path: /filesystem/unlink.php

See also

PHP functions related to the filsystem

Index