Re: global variables in php4 code
| From: | Chuck Burgess | Date: | Mon, 08 Oct 2007 13:12:18 +0000 |
| Subject: | Re: global variables in php4 code | ||
| References: | 1 2 3 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-48238@lists.php.net to get a copy of this message | ||
On 10/8/07, Lukas Kahwe Smith <mls@pooteeweet.org> wrote:
>
> but instead is defined inside the function scope
I thought that this usage indicated that the actual global variable
declaration was done somewhere else, and the only way to use the global from
inside your class/method block was to mention it via the "global" command,
almost like it really meant "import $MyGlobal". So, my understanding was
the variable is being declared/set elsewhere, and is only being imported
into the class/method block via the "global" command.
How does -> global $MyGlobal;
differ from -> global $GLOBALS['MyGlobal'];
in this scenario?
Is there a danger that you've inadvertently redeclared $MyGlobal somewhere
in your local code, not intending for it to replace $GLOBALS['MyGlobal'],
meaning it's possible that both could exist separately?
--
CRB
Let me introduce you to my very own DMCA-protected encryption key:
BC 1B 64 4A 8D DE 49 E8 C3 7D CC EE 1A AD EE F5
(compliments of Freedom-to-Tinker http://www.freedom-to-tinker.com/?p=1155)