Re: Re: register_globals odd behaviour?
| From: | Richard Lynch | Date: | Wed, 22 Aug 2001 20:27:27 +0000 |
| Subject: | Re: Re: register_globals odd behaviour? | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-63966@lists.php.net to get a copy of this message | ||
> What is the reason that I should not use the array? Is there any problem
> doing it that way?
They array is simply not designed for you to use as if it were your
variable.
What you want to do is this:
<?php
# Beginning of script:
session_start();
session_register('count');
$count = $HTTP_SESSION_VARS['count'];
.
.
.
# In your class methods:
class ...
function ...
global $count;
}
}
.
.
.
# At the end of your script.
# Nothing. $count is your variable, it's registered, coo coo ka choo
?>
You are changing $HTTP_SESSION_VARS['count'], but I'm betting the *GLOBAL*
variable $count is not changing, and *THAT* is what was registered, and
*THAT* is what gets save. $count in the global name-space.
--
WARNING richard@zend.com address is an endangered species -- Use
ceo@l-i-e.com
Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm