php8.5
Home/ Manual/ predefined / variables/ $_COOKIE

$_COOKIE

PHP function Edit on GitHub ✎

HTTP Cookies

Description

An associative array of variables passed to the current script via HTTP Cookies.

Examples

$_COOKIE example

php
<?php
echo 'Hello ' . htmlspecialchars($_COOKIE["name"]) . '!';
?>

Assuming the "name" cookie has been set earlier

The above example will output something similar to:

output
Hello Hannes!

Notes Is-superglobal

See Also

Source: language/predefined/variables/cookie.xml · from the official PHP manual (php/doc-en)