April 2026
Intermediate
1009 pages
34h 15m
English
As noted, cookie processing (read/write) takes place entirely via HTTP headers. But PHP would not be PHP if this laborious process had to be carried out by the user.
The setcookie() function has two different syntax options. The most common is the following syntax (we will deal with the alternative later):
boolean setcookie ( string name [, string value [, int expires [, string path [, string domain [, bool secure[, bool httponly]]]]]])
Table 14.1 explains the meanings of the seven parameters. Based on that quantity, you will appreciate PHP’s feature of named function parameters, but this will have to wait a few more pages, because there is a special feature to consider first.
Read now
Unlock full access