PHP Cookies – How to set, read and delete a cookie in PHP?
HTTP is a stateless protocol. It means user sends a request, a server responds to that request without remembering the request later. To track important information (such as user preference, user activity etc.) on a website cookies are very useful. In this blog post, You are going to learn what is a cookie and How to create, set, read and delete a cookie in PHP.
What is Cookie?
Cookies are very useful to store small information in a remote browser (user browser). It’s a simple text file which stores maximum 4KB of data.
Cookies are created by a browser on the request of a server (as per program logic). Once a cookie is created on a user browser, the browser sends that cookie information back to the server using HTTP Header.