Home / PHP Tips Generated By ChatGPT / Reading a Cookie in PHP Read a cookie if it exists. Source Code if(isset($_COOKIE['user'])) { echo "User cookie value: " . htmlspecialchars($_COOKIE['user']); } else { echo "Cookie 'user' is not set."; }