[UPHPU] $GLOBALS and global best practices
Walt Haas
haas at xmission.com
Mon Nov 7 10:52:00 MST 2011
The Wikipedia article corresponds with my experience using them:
http://en.wikipedia.org/wiki/Global_variable
The problem is to keep track of what part of the program is changing
which global under what circumstances. Certain globals, such as the
session description, are unavoidable. For other shared information, I
find that defining a singleton object is a better tool because I can
more easily identify who is using it.
-- Walt
On 11/07/2011 10:39 AM, Wade Preston Shearer wrote:
> What are the groups thoughts on use of the $GLOBALS superglobal and using the global command to pull variables into scope? Are there times when using these are considered good practice or would good architecture always provide an alternate solution (such as passing the variable into the function)?
>
> _______________________________________________
>
> UPHPU mailing list
> UPHPU at uphpu.org
> http://uphpu.org/mailman/listinfo/uphpu
> IRC: #uphpu on irc.freenode.net
More information about the UPHPU
mailing list