What is the common method to delete a cookie in PHP?
To delete a cookie in PHP, you need to set the cookie with an expiration time in the past. This will prompt the browser to remove the cookie from its storage.
// Set the cookie with an expiration time in the past to delete it
setcookie("cookie_name", "", time() - 3600, "/");
Related Questions
- What are the advantages of using a Formmailer instead of the mail function in PHP for sending emails?
- In the provided PHP code snippet, what potential pitfalls or errors could cause the HTML output to be empty when viewed in a browser?
- How can you optimize the retrieval of the last 10 entries from a MySQL table in PHP for better performance?