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 can PHP be used to retrieve and display data from a database on the same page as a form?
- Are there any best practices or alternative methods to achieve the desired output of displaying images in multiple columns from a database in PHP?
- What are the potential pitfalls of using nested if statements in PHP code?