With the isset()
function, which checks the existence of all variables, we can determine if a cookie is defined. The use of this function will be used with the if statement.
<?php
echo isset($_COOKIE['nothing']);
?>
If nothing is displayed, FALSE is returned. Because we did not define such a cookie. If there was a defined cookie, it would write 1 on the screen.