Re: deleting $_SESSION

From: Date: Mon, 11 Apr 2005 18:38:38 +0000
Subject: Re: deleting $_SESSION
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-212823@lists.php.net to get a copy of this message
Jochem Maas wrote:
AndreaD wrote:
I have a session variable called $_SESSION['total'] the problem is I can't delete/reset it. I have tried $_SESSION['total']= 0; $_SESSION['total']= "";
I guess you didn't know/think of trying null: $_SESSION['total'] = null; ...which has the same effect as using: unset($_SESSION['total']); // as you have been told on at least 3 diff occasions ;-)
Not true. If you set it to null, it still exists...it's just null. If you unset it, the variable no longer exists. $_SESSION['total'] = null; if ( isset ( $_SESSION['total'] ) ) { echo ( "Yes" ); } else { echo ( "No" ); } unset ( $_SESSION['total'] ); if ( isset ( $_SESSION['total'] ) ) { echo ( "Yes" ); } else { echo ( "No" ); } -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 john@kegworks.com

« previous php.general (#212823) next »