Re: Clear ALL Cookies previously set
| From: | Eugene Lee | Date: | Sat, 20 Sep 2003 08:43:37 +0000 |
| Subject: | Re: Clear ALL Cookies previously set | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-163283@lists.php.net to get a copy of this message | ||
On Fri, Sep 19, 2003 at 09:14:57PM -0400, Stevie D Peele wrote:
:
: How can I clear all cookies that have been previously set?
:
: I want this in an if statement so something like
:
: if ($value == $blue){
: clear all cookies;
: setcookie("name",time()+3600);
: }
Walk through your $_COOKIE array and expire each one:
if ($value == $blue)
{
foreach ($_COOKIE as $name => $value)
{
setcookie($_COOKIE["$name"], "", time()-3600);
}
}
But I don't know what might happen if you use setcookie() to expire a
cookie and then use setcookie() later on to set the same cookie.