DEV Community

Baransel
Baransel

Posted on

Deleting a file in PHP

You can destroy the file you want with the unlink() function, which we will see as the opposite of the file creation function.

Its use is as simple as the build function and has one parameter.

unlink('hello.txt');
Enter fullscreen mode Exit fullscreen mode

It deletes the hello.txt file that we are working on.

Follow my blog for more baransel.dev.

Top comments (0)