RE: how to get var name and value from function?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 17 April 2007 01:18, Richard Lynch wrote:

> On Mon, April 16, 2007 12:10 pm, Ford, Mike wrote:
> > No, not "just another array" (although I agree about the function
> > being pretty useless!) -- $GLOBALS is a superglobal array that
> > contains a reference to every variable defined in the global scope,
> > so that accessing $GLOBALS['var'] from anywhere is the same as
> > accessing $var in the global scope.  It's a way of referencing
> > global variables without having to use a "global $var" statement.
> 
> So, as far as I can tell, you're avoiding using the documented feature
> "global $var" and cramming things into $GLOBALS which happens to work
> but is an undocumented feature?
> 
> All the ills associated with "global $var" are still there, of course.

Of course -- this can be a matter of personal preference, but I have seen the use of $GLOBALS advocated over the global keyword as part of the knowing-where-your-data-came-from-at-the-point-of-use frame of mind.
 
> Or is it explicitly stated in the manual somewhere I'm not seeing that
> one can put things in $GLOBALS directly? [shrug]

http://uk2.php.net/manual/en/language.variables.predefined.php#language.variables.superglobals


Cheers!

Mike

---------------------------------------------------------------------
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: m.ford@xxxxxxxxxxxxxx
Tel: +44 113 812 4730          Fax:  +44 113 812 3211 


To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux