eranwein Posted March 14, 2006 Share Posted March 14, 2006 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? Quote Link to comment https://forums.phpfreaks.com/topic/4971-session-problem/ Share on other sites More sharing options...
hitman6003 Posted March 14, 2006 Share Posted March 14, 2006 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] Quote Link to comment https://forums.phpfreaks.com/topic/4971-session-problem/#findComment-17565 Share on other sites More sharing options...
eranwein Posted March 15, 2006 Author Share Posted March 15, 2006 thanks a lot Quote Link to comment https://forums.phpfreaks.com/topic/4971-session-problem/#findComment-17610 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.