The following code is used to set a cookie that will expire after one hour

<?php
setcookie('cookieName', 'cookieValue', time()+3600, '/');
?>

if I want to set a cookie that should never expire, what I have to do?

thanx

Simple solution - set the time stamp to 10years later! Not many people will use a computer that long this day. Disk clean up or installing new browser version will also delete your cookies anyway.

i agree, I have some cookies on my computer that are set to expire on Tuesday, June 02, 2037 1:02:03 PM

that one in particular was set by yahoo, I have another one by google that is set to expire on Sunday, January 17, 2038 4:00:00 PM so as long as you set it to some ridiculous long time in the future, you will bet set.

heck I even have one from daniweb.com that is set until Sunday, January 17, 2038 4:00:00 PM

Sunday, January 17, 2038 4:00:00 PM ? Is there something special about this date?

Sunday, January 17, 2038 4:00:00 PM ? Is there something special about this date?

I doubt it, what it probably is, is that they use the same advertising companies (ie: advertising.com, etc...) and they advertiser sets the cookie but who knows

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.