A cookie is a small file that the server embeds on the user's computer and it is often used to identify a user.
Cookie is created at server side and saved to client browser. Each time when client sends request to the server, cookie is embedded with request. Such way, cookie can be received at the server side.
Create Cookies With PHP
A cookie is created with the setcookie() function.
setcookie(name, value, expire, path, domain, secure, httponly);
PHP Create/Retrieve a Cookie
It creates a cookie named "text" with the value "Tutorial Codplay". The cookie will expire after 20 days. The "/" means that the cookie is available in entire website
Example - create/retrieve a cookie
Modify a Cookie Value
Just set the cookie using the setcookie() function to modify a cookie.
Delete a Cookie
To delete a cookie, use the setcookie() function with an expiration date in the past.