How to delete/unset a cookie on php?

Someone picture Someone · Dec 1, 2011 · Viewed 43.2k times · Source

I want to unset/delete my existing cookie with this:

setcookie ("user", "", time()-1); 
unset($user);

But cookies can not be deleted or unset. So what is problem?

Answer

Sonal Khunt picture Sonal Khunt · Dec 1, 2011

you can unset cookies this way only may -1 not work

try this

setcookie ("user", "", time() - 3600);