Jump to content

Recommended Posts

//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?

Link to comment
https://forums.phpfreaks.com/topic/50478-unsetting-session-array/
Share on other sites

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!

	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?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.