0

Can I use strtotime for deleting cookies?

setcookie("user", $row['email'],strtotime('+30 days'));

as per my logout.php, i used

setcookie("user", $row['email'], strtotime('-30 days'));

is this possible?

Andreas
  • 23,610
  • 6
  • 30
  • 62
  • 1
    This link will help you to do this. https://stackoverflow.com/questions/686155/remove-a-cookie – Nikhil Parmar Sep 15 '17 at 07:02
  • 1
    Why -30 days? Isn't "now" enough? – Andreas Sep 15 '17 at 07:05
  • 1
    If you want to delete the cookies, you just need to set expire time to something which is passed. even 1 second is also fine! no need to set it to -30 days. It will simply overwrite the expire time. I hope it will clear your concept to delete cookies! – Nikhil Parmar Sep 15 '17 at 07:09

0 Answers0