Re: strange behaviour of unset()

From: Date: Mon, 08 Jul 2002 09:44:16 +0000
Subject: Re: strange behaviour of unset()
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-106053@lists.php.net to get a copy of this message
Hi Liviu You also need to unregister the session var using session_unregister - unset will just unset the global. http://www.php.net/manual/en/function.session-unregister.php Rgds John ----- Original Message ----- From: "Liviu Andrei" <liv999@hotmail.com> To: <php-general@lists.php.net> Sent: Monday, July 08, 2002 7:47 AM Subject: [PHP] strange behaviour of unset() > Hi everybody! > > I just switched from 4.0.6 to 4.2.1 (register_globals is ON) and I noticed > that unset() is not working properly. Specifically, if I use "unset($a)" in > a page, $a becomes not set in THAT page, but for the next pages (using > sessions) $a gets back at its value. Here is the sample: > > page1: > > session_start(); > session_register("a"); > $a="toto"; > echo $a; > > OUTPUT: toto > > page 2: > > session_start(); > unset($a); > echo $a; > > OUTPUT: > (nothing) > > page 3: > > session_start(); > echo $a; > > OUTPUT: toto > > > Have I done anything wrong? Have the rules changed recently? The manual > still reads: > > "unset() destroys the specified variables" > > Thanks! > > > > _________________________________________________________________ > MSN Photos is the easiest way to share and print your photos: > http://photos.msn.com/support/worldwide.aspx > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >

« previous php.general (#106053) next »