what you should know about cookies before start using in php?

There are a few things you should be aware of:

1. Since cookies are used to record information about your activities on a particular domain, they can only be read by the domain that created them

2. A single domain cannot set more than twenty cookies, and each cookie is limited to a maximum size of 4 KB

3. A cookie usually possesses six attributes, of which only the first is mandatory. Here they are:
* name: the name of the cookie
* value: the value of the cookie
* expires: the date and time at which the cookie expires
* path: the top-level directory on the domain from which cookie data can be accessed
* domain: the domain for which the cookie is valid
* secure: a Boolean flag indicating whether the cookie should be transmitted only over a secure HTTP connection

It's important to remember that, since cookies are stored on the user's hard drive, you as the developer have very little control over them. If a user decides to turn off cookie support in his or her browser, your cookies will simply not be saved. Therefore, avoid writing code that depends heavily on cookies; and have a backup plan ready in case cookie data cannot be retrieved from the client.

Two types of cookies

1) temporary and
2) persistent cookies

Post new comment

The content of this field is kept private and will not be shown publicly.
CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Copy the characters (respecting upper/lower case) from the image.