Re: $GLOBALS, any probolems?

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

 



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

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