Using the PHP Function SetrawCookie
Cookies are small text files that a web server embeds on a user's computer. Each time the browser requests a page from the server, it sends the cookie along with the request. Cookies are often used to identify users and to deliver a more personalized web experience. In PHP, cookies can be created and retrieved using the setcookie() function.
Using php function setrawcookie
The php function setrawcookie() sets an HTTP cookie without URL encoding the value. This is useful in situations where the cookie value contains special characters that would be encoded by URL encoding (or decoded when received) and you wish to avoid this step. In addition, URL encoding can introduce extra spaces or other characters that are not in the cookie format and thus would break the value when sent.
Setting a Cookie
The setcookie() function takes five parameters: name, value, expiry, path, and domain. The name specifies the name of the cookie, the value specifies the value stored in the cookie, the expiry specifies a timestamp after which the cookie cannot be accessed, and the path sets the path on the server for which the cookie is available. The optional security parameter can be set to require that the cookie only be transmitted over secure connections.
The cookie is then assigned to the super global $_COOKIE variable. The value can then be retrieved using the isset() function. To delete a cookie, the same arguments are passed to setcookie() as when it was set.