2

Whenever I try to delete the counter.txt using PHP, I always get an error:

Fatal error: Call to undefined function delete() in C:\XAMPP\htdocs\jellykat\control-panel.php on line 12

Here is my code:

<?php delete("counter.txt"); ?>

What's wrong with it? Can you suggest me ways on the other methods that I can delete the counter.txt?

Don't blame me. I got the delete() method from here: http://www.w3schools.com/php/func_filesystem_delete.asp

3
  • 2
    That isn't how you delete a file in PHP. Try unlink instead. Commented Apr 13, 2014 at 16:00
  • 1
    Dont use w3schools to look up PHP function. Always use php.net. Commented Apr 13, 2014 at 16:04
  • As per what PHP states on the subject - "This is a dummy manual entry to satisfy those people who are looking for unlink() or unset() in the wrong place." Commented Apr 13, 2014 at 16:12

1 Answer 1

9

You should use unlink() instead .. there is no such delete()

If you see the manual of delete() , It says..

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

So, it should be

<?php unlink("counter.txt"); ?>
Sign up to request clarification or add additional context in comments.

1 Comment

"dummy" being the "operative" word. +1 ;-)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.