A cookie is often used to identify a user. A cookie is a small file that a server installs on a user's computer. Each time the same computer requests a page with a browser, it will send a cookie. With PHP, you can create and receive cookie values.

Application of cookies

Saving session_id - A cookie can save a user_id session_id. This session_id database is secure, which is why it can be used to read session_id when requested on the server.
Providing better user preferences - A cookie may be used to provide a better user experience based on priorities set in a cookie file.


Storing cookies is easy as it does not add additional load on the server. ... The cookie can be easily set. Using cookies can store session information such as pages or threads etc. Cookies, if stored, can be used later without creating cookies.