Deleting a file named "myFile.php" in the same directory

I like to make a file named “delete.php” which delete a file named “myFile.php” in the same directory with “delete.php”.

Can I make the file “delete.php” with your help?
What code should I put for deleting the file “delete.php”?

Hi dotJoon,

You can use the [fphp]unlink[/fphp] function to delete files. You should also check that the file exists first:


$file = 'myFile.php';
if (file_exists($file)) {
    unlink($file);
}