NYCPHP Meetup

NYPHP.org

[nycphp-talk] $_SESSION, session_unset(), unset($_SESSION['var']), register_globals and the PHP Manual

Phillip Powell phillip.powell at adnet-sys.com
Fri Jul 23 14:23:39 EDT 2004


What do they all have in common?  None of them provide for me a clear, 
concise methodology for unsetting a single $_SESSION variable!

In my original code I have a class method that, at the end, does a 
"cache clear" by removing a $_SESSION variable:

unset($_SESSION['mainDisplay']);

This works fine in on the one server with PHP 4.3.2 with 
register_globals off

However, on the other server with PHP 4.3.6 with register_globals on the 
$_SESSION variable persists anyway.  On the PHP Manual I read about 
session_unset(), but that removes all session variables, which I clearly 
do not want to do with this particular class method (I only want to 
remove $_SESSION['mainDisplay'] and nothing more).

What is the best-coding-practice method to remove a single $_SESSION 
variable, whether register_globals is on or off?

Thanx
Phil

-- 
---------------------------------------------------------------------------------
Phil Powell
Multimedia Programmer
BPX Technologies, Inc.
#: (703) 709-7218 x107 
Fax: (703) 709-7219

	




More information about the talk mailing list