Re: session_unregister question
| From: | Richard Lynch | Date: | Sat, 20 Jul 2002 05:45:31 +0000 |
| Subject: | Re: session_unregister question | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-108624@lists.php.net to get a copy of this message | ||
>Is it possible to somehow do a session unregister of all session variables
>except for (say) 2 variables. varA and varB
>
>So if my session had :
>varA, varB,varC, varD,varE (etc)
>
>I want to unregister all but varA and varB.
>
>Is there an 'elegant' way to do this without testing for all the variables
>in the session?
session_destroy();
session_register('varA');
session_register('varB');
*MIGHT* "work" but you'd be relying on implementation details rather than
documented behviour...
Risky in the long run, but might last forever, if it works...
You're probably safer to loop through $_SESSION and unregister everything
except the ones you want. It shouldn't be that big of a loop.
--
Like Music? http://l-i-e.com/artists.htm