I\'ve tried
$cookie = $_COOKIE[\'cookie\'];
if the cookie is not set it will give me an error
PHP ERROR Undefined index: cook
You can use array_key_exists for this purpose as follows:
$cookie = array_key_exists('cookie', $_COOKIE) ? $_COOKIE['cookie'] : null;