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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.