Re: deleting $_SESSION

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxx

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux