manual/en/features.cookies.php
ARCHIVED 2020-10-01, DATE APPROXIMATE · VERSION 20201001_rev01 · COMPARED WITH 20200601_rev01
Full text changes — 20200601_rev01 to 20201001_rev01
COLOUR MARKS THE SEVERITY OF A FLAGGED CLAUSE · + AND − MARK ADDED AND REMOVED
| 1 | 1 | PHP transparently supports HTTP cookies. Cookies are a mechanism for storing data in the remote browser and thus tracking or identifying return users. You can set cookies using the [setcookie()](https://www.php.net/manual/en/function.setcookie.php) or [setrawcookie()](https://www.php.net/manual/en/function.setrawcookie.php) function. Cookies are part of the HTTP header, so [setcookie()](https://www.php.net/manual/en/function.setcookie.php) must be called before any output is sent to the browser. This is the same limitation that [header()](https://www.php.net/manual/en/function.header.php) has. You can use the [output buffering functions](https://www.php.net/manual/en/ref.outcontrol.php) to delay the script output until you have decided whether or not to set any cookies or send any headers. |
| 2 | 2 | |
| 3 | Any cookies sent to server from the client will automatically be included into a [$\_COOKIE](https://www.php.net/manual/en/reserved.variables.cookies.php) auto-global array if [variables\_order](https://www.php.net/manual/en/ini.core.php) contains "C". If you wish to assign multiple values to a single cookie, just add _\[\]_ to the cookie name. | |
| 3 | Any cookies sent to server from the client will automatically be included into a [$\_COOKIE](https://www.php.net/manual/en/reserved.variables.cookies.php) auto-global array if [variables\_order](https://www.php.net/manual/en/ini.core.php) contains "C". If you wish to assign multiple values to a single cookie, just add `[]` to the cookie name. | |
| 4 | 4 | |
| 5 | 5 | On older PHP systems (5.3 or earlier), [register\_globals](https://www.php.net/manual/en/ini.core.php) may be enabled, which may cause undesirable and insecure operation. If this is enabled, cookies will be registered as global variables. |
| 6 | 6 | |
| 7 | 7 | For more details, including notes on browser bugs, see the [setcookie()](https://www.php.net/manual/en/function.setcookie.php) and [setrawcookie()](https://www.php.net/manual/en/function.setrawcookie.php) function. |
| 8 | 8 | |
| 9 | 9 | There are no user contributed notes for this page. |