1. Home
  2. Docs
  3. Web Technology II
  4. Cookies, Sessions and Aut...
  5. Destroying Cookies in PHP

Destroying Cookies in PHP

Syntax:

To destroy a cookie, you need to set its expiration time to a past date.

Example:

// Deleting a cookie by setting its expiration time to a past date
setcookie("user", "", time() - 3600, "/");

How can we help?

Leave a Reply

Your email address will not be published. Required fields are marked *