Re: Re: How Do I make Global Scope Variables AvailabletoFunctions

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

 



On 29.05.2018 at 16:18, John wrote:

> Thanks for your reply Christoph.  From your and other comments it appears that I
> can't do what I was trying to do.  
> 
> On the one hand, it is satisfying that I wasn't making a mistake; on the other,
> I sure wish there was a way to avoid passing all these variables in PHP!  In a
> way it makes the "function" command far less valuable than it should be!

On the contrary, I'd say!  If I see a variable inside a function body, I
almost immediately know that it is a local variable or a function
parameter (or a superglobal), unless there is a global “declaration”.
Even better, each time I add a global “declaration”, I'm reminded to
think of a better way to express myself, and if I see a lengthy list of
globals, I know that the code will be hard to maintain.  See also
<http://wiki.c2.com/?GlobalVariablesAreBad>.

-- 
Christoph M. Becker

-- 
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