I delete the cookie file by the following action:
setcookie("non_reg_user", " ", time() - 30, "/"); Further down the code I have an if block that checks if cookies are deleted:
setcookie("non_reg_user", " ", time() - 30, "/"); if (!isset($_COOKIE['non_reg_user'])) { echo "cookie is gone!"; } The problem is that if the block only works after 2 page reloads. How can you make the if block work during the first page load?