Search code examples
phpfile-iounlink

What is the difference between delete() and unlink() in PHP


When I started searching for "How to delete a file in PHP" The solution I got almost everywhere is "unlink()"

But in w3schools I met with another function named delete(). Here is that link delete() function w3schools

And I started surfing about delete() but didn't get much answers..

This is the question similar to my question at stackoverflow.. DIfferent between unlink() and delete() on unix

I really would like to know the difference and similarities between these two functions.. Why we are using unlink() instead of delete().


Solution

  • delete() function doesn't exist as the php docs says

    This is a dummy manual entry to satisfy those people who are looking for unlink() or unset() in the wrong place.

    a dummy manual entry was created to catch anyone that is looking for a function that they assume to exist but doesn't really exist then guide them to the right function

    http://php.net/manual/en/function.delete.php