Re: how to unregister session stored as multidimensional array?
| From: | Curt Zirzow | Date: | Mon, 05 Dec 2005 21:54:20 +0000 |
| Subject: | Re: how to unregister session stored as multidimensional array? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-226899@lists.php.net to get a copy of this message | ||
On Mon, Dec 05, 2005 at 02:45:43PM -0600, afan@afan.net wrote:
> Is this possible at all:
> I have stored info from form in session:
> $_SESSION['client']['name'] = 'Name'
> $_SESSION['client']['address'] = 'Address'
> $_SESSION['client']['city'] = 'City'
> $_SESSION['client']['state'] = 'State'
> $_SESSION['client']['zip'] = 'Zip
>
> Now, I want to unregister all $_SESSION['client'] info EXCEPT
> $_SESSION['client']['name'].
All you need to do is redifine what the $_SESSION['client'] array's
definition is:
$_SESSION['client'] = array('name' =>
$_SESSION['client']['name']);
>
> With
> session_unregister('client');
Don't mix session_*register() functions with the use of $_SESSION.
Those functions are only there for old scripts to work, see
http://php.net/session_unregister (the second
Caution)
To register a session var:
$_SESSION['client'] = $client;
To unregister a session var:
unset($_SESSION['client']);
Curt.
--
cat .signature: No such file or directory