Jump to content

Archived

This topic is now archived and is closed to further replies.

eranwein

SESSION problem

Recommended Posts

i have an array stored in $_SESSION.
($_SESSION['some_array']).

how do i remove it from the session without using unset() for each of the array values?

Share this post


Link to post
Share on other sites
If you want to remove the $_SESSION['some_array'] totally, use

[code]unset($_SESSION['some_array']);[/code]

If you want to set it to a blank array:

[code]$_SESSION['some_array'] = array();[/code]

Set it to a blank string:

[code]$_SESSION['some_array'] = "";[/code]

If you want to remove a single element of the array $_SESSION['some_array']:

[code]unset($_SESSION['some_array']['some_value']);
or
$_SESSION['some_array']['some_value'] = "";[/code]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.