Hi,
Actually is what I do but since register global is off, I do:
# Beginning of script:
session_start();
session_register('count');
$sess_object->count = $HTTP_SESSION_VARS['count'];
.
.
.
# In your class methods:
class ...
var $count
function ...
# global $count; not needed anymore
$count++;
.
.
}
}
.
.
.
# At the end of your script.
# Nothing. $count is your variable, it's registered, coo coo ka
choo
$HTTP_SESSION_VARS['count'] = $sess_object->count;
# This is actually inside a function
?>
I do not know if this is bad because the way $HTTP_SESSION_VARS[] is
designed or what. Just wanted to know if there is some real problem like
references or some problem that would cause data missing or becoming
corrupt. Thanks.
Sean C. McCarthy
SCI, S.L. (www.sci-spain.com)
Richard Lynch wrote:
>
> > 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 [EMAIL PROTECTED] address is an endangered species -- Use
> [EMAIL PROTECTED]
> 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
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]