Take the 2-minute tour ×

If i've $_SESSION["something"] and $_SESSION["else"] by using session_destroy() it will destroy both.

but what if i want only to destroy exact session which is $_SESSION["something"] and keeps $_SESSION["else"] active.

share|improve this question
You cant have multiple sessions. Those are variables/entries/objects/whatever in your session. –  user849137 Mar 16 '12 at 13:43
session_destroy() does NOT unset your $_SESSION values. As is clearly mentioned in the manual. ;) –  nem75 Mar 16 '12 at 15:31

3 Answers 3

up vote 2 down vote accepted

You can unset($_SESSION['something']).

Bear in mind that these aren't separate sessions, they're entries in the same session id. You only have one active session.

share|improve this answer
~ thanks a lot works perfect. –  Jack Ben Mar 16 '12 at 13:42

$_SESSION is like a normal array.....so use unset to clear whatever you want ...as suggested in previous answer.....

share|improve this answer

unset( $_SESSION['variable'] );

The above will not work with register_globals turned on (will only work outside of a function).

$variable = $_SESSION['variable']; unset( $_SESSION['variable'], $variable );

The above will work with register_globals on & inside a function

share|improve this answer

Your Answer


