Re: Using unset with $_SESSION

From: Date: Tue, 27 Jan 2004 16:11:50 +0000
Subject: Re: Using unset with $_SESSION
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-175937@lists.php.net to get a copy of this message
trlists@clayst.com wrote:
On 27 Jan 2004 Stuart wrote:
I am trying to find a reliable method to clean out all session variables and start clean.
http://php.net/session_destroy
That destroys the file but (at least the docs say) does not clean out the global variables, and does not seem to work in my example.
In that case, try this... foreach (array_keys($_SESSION) as $key)
    unset($_SESSION[$key]);
Untested, but should work. -- Stuart

« previous php.general (#175937) next »