You need to delete a cookie in your PHP script. How would you do this?

  • setcookie() with expiry 0
  • unset($_COOKIE['cookie_name'])
  • delete_cookie()
  • remove_cookie()
To delete a cookie in PHP, you can use the setcookie() function with an expiration time in the past or set it to zero. This will invalidate the cookie and remove it from the user's browser. Alternatively, you can use the unset() function to remove a specific cookie value from the $_COOKIE superglobal array. More details: http://php.net/manual/en/function.setcookie.php
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *