Re: static vs global variable [message #172709 is a reply to message #172698] |
Sun, 27 February 2011 01:42 |
Leonardo Azpurua
Messages: 46 Registered: December 2010
Karma:
|
Member |
|
|
"The Natural Philosopher" <tnp(at)invalid(dot)invalid> escribió en el mensaje
news:ikb2fq$o8f$1(at)news(dot)albasani(dot)net...
>
> That's maybe possible if you are writing OO code, but it is often
> simpler when having functions that modify several different
> variables, to have then as globals, in order not to either pass
> pointers to the functions, or try and work out a way to return more
> than one variable from a function.
Hi,
Perhaps I have become thick with the years, but I can't imagine why a
function should be required to modify several different global
variables.
If you don't want to enter into all the details and subtleties of OOP,
fine. But using and object to pack all the data required by a given
process, and pass it to any function that might need it is even easier
than having to remember the names of every global variable involved in
a complex procedure.
I am completely new to PHP, but it is universal programming common
sense, like using structs in C, or Records in Pascal.
--
|
|
|