I assign a cookie to a variable:
$user_cookie = $_COOKIE[\"user\"];
How can I check if the $user_cookie
received some value or
If your cookie variable is an array:
if (!isset($_COOKIE['user']) || empty(unserialize($_COOKIE['user']))) {
// cookie variable is not set or empty
}
If your cookie variable is not an array:
if (!isset($_COOKIE['user']) || empty($_COOKIE['user'])) {
// cookie variable is not set or empty
}
I use this approach.