You are here: Re: [PHP] deleting $_SESSION « PHP « IT news, forums, messages
Re: [PHP] deleting $_SESSION

Posted by John Nichel on 04/11/05 21:38

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация