Re: Global variables - please explain me someone.
| From: | Christian Reiniger | Date: | Fri, 23 Feb 2001 11:32:24 +0000 |
| Subject: | Re: Global variables - please explain me someone. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-41300@lists.php.net to get a copy of this message | ||
On Friday 23 February 2001 08:50, Dezider Góra wrote:
Disclaimer: I have never touched ASP, so I'm likely to have gotten
somethings wrong..
> function too ). But in asp, there were couple types or scopes.
> Asp got "application" and "session". Application is something like a
> virtual directory, and when first time hit, it inicialize itself and
> actions like application.on_start fires. You can define your own
> application variables, that are "global" for that application. At the
> same time it starts a new session, where you can have your own session
> vars. All sessions in application can freely access application
> variables, which are good for storing connection strings, counter
> variables, etc. Session vars are good for login infos, etc.
> Now back to php. What I want to know is, if I declare variable global -
> is it global for current session or all sessions? I know about
It is global for the current invocation of the script (and all code
included from it). To make variables global between all
invocations/scripts in a given session, you need to use the session
management functions of PHP4. Look at the manual and search
phpbuilder.com for some intro on that.
> And one thing more. What EXACTLY means php configuration value:
> register_global?
If set to "on", PHP automatically generates global vars from values
passed via GET/POST requests and cookies. Example: calling
http://foo.bar/test.php?answer=42
will call test.php with a global variable $answer set to "42"
--
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)
Nothing is more dangerous than an idea if it's the only one you have.
- Emil-Auguste Chartier, "Propos sur la religion", 1938