Working with Cookies in PHP

Working with Cookies in PHP Cookies allow users to store a small amount of data, not more than 4KB within the user’s browser itself. Then, whenever the browser requests a page on the Web site, all the data in the cookie is automatically sent to the server within the request. This means that when a user sends the data once to the browser, and the data is automatically available to the script from that moment onward.

A user can make a cookie last for a fixed amount of time from a few seconds to several years.

A user can also set a cookie to expire once the browser application is closed. Most modern browsers can store up to 30 cookies per Web site domain.

Cookies are more secure than using query strings. Cookies are very useful tool.