|
Posted by Richard Lynch on 02/10/05 21:17
Bruno B B Magalhães wrote:
> is there any problems using $GLOBALS superglobal to carry all my global
> classes instances?
>
> For example:
> $GLOBALS['myclass'] = new myclass();
This is exactly the same as:
$myclass = new myclass();
as far as I've ever been able to tell, except that $GLOBALS is a
super-global, so it will "work" inside a function as well as outside.
For a brief period, it seemed like people were hot on using that instead
of 'global' in a function, so they didn't have to understand scoping. Or
maybe it was the guys tired of trying to explain scoping to newbies who
were hot on it. :-^
Seems to me, you'd be better off understanding scoping rules and using
'global' so if you ever want to use another language, you'll have the good
programming habits, knowledge and skills you'll need.
But that's just my personal opinion. Somebody gonna post and disagree
with me, almost for sure. :-)
--
Like Music?
http://l-i-e.com/artists.htm
[Back to original message]
|