By default, the cookies are set to be deleted when the browser is closed. We can override that default by setting a time for the cookie’s expiration but there may be occasions when you need to delete a cookie before the user closes his browser, and before its expiration time arrives. To do so, you should assure that the expiration date is in the past. To destroy the cookie, simply use setcookie.

Example:
Code:

// set the expiration date   to one hour  ago
setcookie("lastVisit",   "date("G:i - m/d/y")", time()-3600);

Explanation:

It sets expiration time 1 hour ago.

eXTReMe Tracker