Re: global variables in php4 code
| From: | Chuck Burgess | Date: | Mon, 08 Oct 2007 12:59:52 +0000 |
| Subject: | Re: global variables in php4 code | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-48236@lists.php.net to get a copy of this message | ||
On 10/8/07, Lukas Kahwe Smith <mls@pooteeweet.org> wrote:
>
> that global $_Text_Password_NumberOfPossibleCharacters var definition
> seems incorrect to me. it should use $GLOBALS explicitly as otherwise it
> might cause issues if included inside a function. thoughts?
>
I'm curious about what possible problems this raises. Some PHP4 code I have
to work on includes several global variables, that are constantly being
referenced everywhere. I've somewhat avoided it, in that I'll wrap a
particular global with a get() method, and in all the remaining functions
just use what that get() returns, rather than referencing the global
variable directly anywhere else but inside the get() method. So, if there
are gotchas out there in referencing a global variable like
global $MyGlobal;
without using the $GLOBALS array, I need to understand.
--
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)