Re: New Session Variable unset doesn't work
| From: | Pedro Pontes | Date: | Fri, 03 May 2002 13:20:29 +0000 |
| Subject: | Re: New Session Variable unset doesn't work | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-95889@lists.php.net to get a copy of this message | ||
Yes, always remember that unset() deletes the REFERENCE to the variable, not
the variable itself, so in the next page, when you session_start() again,
the reference is recreated to the still existing value.
So, session_unregister is fundamental to unregister the reference from the
session.
To destroy the variable's value you must use $var = null;
Regards,
--
Pedro Alberto Pontes
"Dan Hardiker" <dhardiker@staff.firstcreative.net> wrote in message
news:62885.194.222.31.228.1020428895.squirrel@adam.firstcreative.net...
> > I somehow cannot unset Session variables. If I set for example
> > $_SESSION["error"]="formcheck" (the new style) and I want to unset it
> > at the end of the page (unset($_SESSION["error"])), it's there again on
> > the next page.
> >
> > Is there a special way to unset the new Session variables?
>
> Seen as you used session_register to set the session variable, it would
> make sense for you to use session_unregister to do the inverse.
>
> --
> Dan Hardiker [dhardiker@staff.firstcreative.net]
> ADAM Software & Systems Engineer
> First Creative Ltd
>
>