session_destroy()
destroys session data but does not unset any of the global variables associated with session or unset the session cookie.
So why should we destroy session?
Can we destroy a session at the end of page each time the session starts in the beginning of that page giving the same functionality without destroying as well?
session_destroy
simply doesn't do its intended job very well, try this approach. – Martinsession_destroy()
, the session cookie is removed and the session is no longer stored on the server. The values in$_SESSION
may still be available, but they will not be on the next page load. – Daan