Cookies are small pieces of data stored in the browser and sent back to the server with every request to the same domain. PHP reads incoming cookies via $_COOKIE and writes them with setcookie().
- Cookies set with
setcookie()are available in$_COOKIEonly on the next request. - Always pass the full
optionsarray (PHP 7.3+) rather than positional arguments. - To delete a cookie, set its expiry to a time in the past.