What is cookie ?
- Cookie is a variable that hold the value for particular time you define.
- Cookie is nothing but store a user information
Syntax :
setcookie('cookie_name', $cookie_value, time()+3600*24, "/");

1. cookie_name = Name of cookie.
2. cookie_value = Cookie value may be either integer or alphanumeric.
3. time = Store a value for particular time. 3600 means 3600 seconds =1 hour and 24 = 24 hours means 1 day. you can define your own time,

How to set cookie ?
example :   $city_name = Dubai;
                   setcookie('city_name', $city_name, time()+3600*24, "/");

How to unset cookie ?
example:    setcookie('city_name', " ", time()-3600, "/");



Reviewed by Admin on March 20, 2020 Rating: 5

No comments:

Powered by Blogger.