View Full Version : Global statements in functions.php
dwh
Thu 6th Sep '01, 2:10am
At first I thought defining globals here meant that the resulting variables were to be usable by the code that called the subroutine, but it seems that these globals are predefined already?? What is their purpose here?
Sorry, should probably know this but I never took a programming class in my life, everything is self taught but I'm obviously missing some basics :)
Mark Hensler
Thu 6th Sep '01, 2:39am
I'm sorry, I don't understand the question.
If you want to learn more about the scope of variables, read here (http://php.net/manual/en/language.variables.scope.php).
Jet
Thu 9th May '02, 6:37am
Originally posted by Mark Hensler
I'm sorry, I don't understand the question.
If you want to learn more about the scope of variables, read here (http://php.net/manual/en/language.variables.scope.php).
Thanks to your tip, I learned something more about global vars... But not enough... yet.. :D
Actually, I'm lookin for a way to set a global variable (seen by EACH php script importing global.php and function), but PER SESSION.
Nothing stored into db, possibly... :)
I mean, I would initially set a memory var $globcount to 0; then
- when user A does something, increment that by 1... $globcount=1
- if another user B does the same thing, i would increment his $globcount var by 1, but as he has another session, his new $globcount is 1 ...
- the day after, for example, when both sessions are expired, I would make the same thing per user, starting again from zero.
I shouldn't trust of cookies, as I'm not sure all the users have them enabled.
Any help ?
Is it possible some way ?
Is there any existing example in vb files of something like ?
Actually I think I should work with $_SESSION / $HTTP_SESSION_VARS arrays, but don't know exactly how (even saw here (http://www.php.net/manual/en/ref.session.php) ... :eek: ) ?
Thanks a lot.
Bye
vBulletin® v3.8.0 Release Candidate 1, Copyright ©2000-2008, Jelsoft Enterprises Ltd.