Click here to Skip to main content
11,636,213 members (71,596 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: PHP
Hi all,

In a page more than 5 session variables had set but i want to unset only single

session variable after a function all..

Help me to do this
Posted 28-Dec-12 19:01pm
Comments
Isuru Nanayakkara at 29-Dec-12 6:54am
   
You won't get any help unless you start it first yourself!
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Is this what you want?
...
 
$_SESSION['session1'] = "1";
$_SESSION['session2'] = "2";
$_SESSION['session3'] = "3";
$_SESSION['session4'] = "4";
$_SESSION['session5'] = "5";
 
...
 
function YourFunction()
{
    unset($_SESSION['session3']);
}
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

unset a session just use

unset($_SESSION['session_name']);
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 jyo.net 295
1 Sergey Alexandrovich Kryukov 275
2 OriginalGriff 233
3 Suvendu Shekhar Giri 225
4 stibee 215
0 OriginalGriff 8,941
1 Sergey Alexandrovich Kryukov 8,459
2 Mika Wendelius 6,849
3 F-ES Sitecore 2,364
4 Suvendu Shekhar Giri 2,320


Advertise | Privacy | Mobile
Web01 | 2.8.150728.1 | Last Updated 6 Jan 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100