I\'ve tried
$cookie = $_COOKIE[\'cookie\'];
if the cookie is not set it will give me an error
PHP ERROR
Undefined index: cook
Depending on your needs.
// If not set, $cookie = NULL;
if (isset($_COOKIE['cookie'])) { $cookie = $_COOKIE['cookie']; }
or
// If not set, $cookie = '';
$cookie = (isset($_COOKIE['cookie'])) ? $_COOKIE['cookie'] : '';
or
// If not set, $cookie = false;
$cookie = (isset($_COOKIE['cookie'])) ? $_COOKIE['cookie'] : false;
References: