You are here: Re: [PHP] $GLOBALS, any probolems? « PHP « IT news, forums, messages
Re: [PHP] $GLOBALS, any probolems?

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация