Page 1 of 1

how to unset all the session variables ?/

Posted: Wed Oct 29, 2008 4:55 am
by susrisha
i want to unset all the session variables for a certain code. then i want to destroy the session. how is it done??

my present code is given below

Code: Select all

 
unset($_COOKIE[session_id()]);
     session_regenerate_id();
     session_destroy();
 
 
Now i want to unset all the variables in session before it gets destroyed. can anyone tell me how to do this??

Re: how to unset all the session variables ?/

Posted: Wed Oct 29, 2008 5:21 am
by papa
Example from php.net:

Code: Select all

            session_unset();
            session_destroy();
            $_SESSION = array();