How can you delete a cookie in PHP?
To delete a cookie in PHP, you can set the cookie's expiration time to a past time. This will effectively remove the cookie from the user's browser.
// Set the cookie's expiration time to a past time
setcookie("cookie_name", "", time() - 3600, "/");
Related Questions
- How does using "__DIR__" as a global variable compare to using $_SESSION["Pfad"] for including files in PHP scripts?
- What are common pitfalls when validating user input in PHP forms, specifically when checking for matching data in a MySQL database?
- Where can beginners find resources to understand and troubleshoot PHP code, such as the foreach loop?