sKunKbad Posted May 8, 2007 Share Posted May 8, 2007 //I have a session array : $_SESSION['OfferListingId'][0]='bob'; $_SESSION['OfferListingId'][2]='ted'; $_SESSION['OfferListingId'][3]='mary'; $_SESSION['OfferListingId'][4]='jill'; $_SESSION['OfferListingId'][5]='spike'; //and when I try to unset the entire array using: unset($_SESSION['OfferListingId']); //it doesn't work. Why not? Quote Link to comment https://forums.phpfreaks.com/topic/50478-unsetting-session-array/ Share on other sites More sharing options...
jitesh Posted May 8, 2007 Share Posted May 8, 2007 session_unregister('OfferListingId'); or $_SESSION['OfferListingId'] = array(); session_unregister('OfferListingId'); Quote Link to comment https://forums.phpfreaks.com/topic/50478-unsetting-session-array/#findComment-248004 Share on other sites More sharing options...
sKunKbad Posted May 8, 2007 Author Share Posted May 8, 2007 neither of those worked, but actually, i dont want to unset them, i want to completely delete them, so I was thinking something like this would work: array_splice($_SESSION['OfferListingId'],0); but it doesn't. I don't know what the heck is going on! Quote Link to comment https://forums.phpfreaks.com/topic/50478-unsetting-session-array/#findComment-248021 Share on other sites More sharing options...
jitesh Posted May 8, 2007 Share Posted May 8, 2007 header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); header('Cache-Control: no-store, no-cache, must-revalidate'); header('Cache-Control: post-check=0, pre-check=0', FALSE); header('Pragma: no-cache'); [b]session_start();[/b] //I have a session array : $_SESSION['OfferListingId'][0]='bob'; $_SESSION['OfferListingId'][2]='ted'; $_SESSION['OfferListingId'][3]='mary'; $_SESSION['OfferListingId'][4]='jill'; $_SESSION['OfferListingId'][5]='spike'; echo "<pre>"; echo "Before"; print_r($_SESSION['OfferListingId']); //and when I try to unset the entire array using: unset($_SESSION['OfferListingId']); echo "<pre>"; echo "After"; print_r($_SESSION['OfferListingId']); [b]exit;[/b] //it doesn't work. Why not? Quote Link to comment https://forums.phpfreaks.com/topic/50478-unsetting-session-array/#findComment-248024 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.