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" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
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
>
>


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

Reply via email to