PHP Classes

How do you delete a cookie

Recommend this page to a friend!

      Secure Cookie  >  All threads  >  How do you delete a cookie  >  (Un) Subscribe thread alerts  
Subject:How do you delete a cookie
Summary:create a cookie from a different function
Author:Jason Mumby
Date:2011-06-01 12:10:24

  1. How do you delete a cookie   Reply   Report abuse  
Jason Mumby - 2011-06-01 12:10:24
I can create a cookie in a function say.

function make_cookie($salt, $userid)
$C = new SecureCookie($salt,'random',time()+3600,'/','');

but how do I delete it from another function? for example//

function delete_cookie()

doesn't work nor does setcookie('random',"", time()-3600) or unset($_COOKIE["random"]);

I tried creating the cookie again in the same function but I just get a 'division by 0' error.