session_unset()
If you want to clear out the session variables, you could either loop through the $_SESSION array or simply call this function.
One thing you may be tempted to do is unset the $_SESSION array. It makes sense on one level but unset($_SESSION); will only bring you sorrow. With that method, you end up not unsetting the session data, plus any changes made to $_SESSION afterwards won’t be saved to the session.
End result: the session remains what it was at the time you called unset($_SESSION);
Looping through the $_SESSION array is one way to go:
foreach($_SESSION as $k=>$v) { unset($_SESSION[$k]); }
But session_unset() does that for you in one easy call and less overhead.
