Cookie is a small file that stored on the client computer. A cookie is used to identify a user.
Syntax
setcookie(name, value, expire, path, domain, secure, httponly);
Set Cookie
setcookie('user','ram',time()+60*60*24);
Access Cookie
echo $_COOKIE['user'];
Remove Cookie
setcookie('user','ram',time()-60*60*24);
Example
setcookie("user","ram",time()+60*60*24);// create cookie
echo $_COOKIE['user'];//access cookie
setcookie("user","ram",time()-60*60*24);//destroy cookie
Output
ram
Copyright ©2022 coderraj.com. All Rights Reserved.