Jump to content

CookIes!


Richard_Grant

Recommended Posts

This is prob a stupid question.. but i've always wondered..

 

When deleting a cookie why do we use 

why do we use:

setcookie($name, '', time() - 3600, "/", "", 0);

 

when this works just fine:

setcookie($name, '', 0, "/", "", 0);

 

 

 

isn't the time() just a waste of space?

 

 

I ask this because everywhere i look i see:

setcookie($name, '', time() -3600 , "/", "", 0);

Link to comment
Share on other sites

Setting the expiration time to the past is a compatibility feature for Internet Explorer.

 

What people miss, however, is that PHP automatically sets the expiration time when you give it an empty value. So the time() stuff doesn't do anything and is arguably a waste of space.

 

:) oh so i can just put ?

setcookie($name, '', NULL, "/", "", 0);

Without any compatibility issues?

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.