Cookie in PHP

By | January 18, 2014

Cookie is usualy store in webbrowser to identify a user.its a small file that server will place this file to the browser.

Example

To set cookie following function will use

setcookie(“vasanthan”, “mydoubts”, time()+3600);

we can change the expire time.

we can access the cookie value using $_COOKIE[“vasanthan”];//here vasanthan is the name of the cookie

For deleting the cookies use the below function

setcookie(“vasanthan”, “”, time()-3600);//here just giving time as minus value.