How to set a cookie to never expire?

Hi All,

Basic cookie syntax:

setcookie(“name”, “fred”, time()+3600);

This sets a cookie variable called “name” with a value of “fred” and set to expire in 1 hour.

I think I read a specification somewhere that said that the maximum expiry time a cookie could be set to was 30 years in the future :slight_smile:

My question: if you want to set a cookie that ‘never’ expires, do you still have to explicity set a (very large)expiry time (in UNIX seconds), or is there some shorthand version that works?

No a big deal - just thought I’d ask.

More info on cookies:

http://www.php.net/manual/en/function.setcookie.php

Just set it year in advance. Most likley every visitor will format, clear cookies or buy a new computer before the year will finish :slight_smile: