You are here: Re: Access the string everywhere in the script « All PHP « IT news, forums, messages
Re: Access the string everywhere in the script

Posted by Steve on 03/27/07 13:17

"Christoph Burschka" <christoph.burschka@rwth-aachen.de> wrote in message
news:56sheiF29re4hU1@mid.dfncis.de...
|
|
| J.O. Aho schrieb:
| >
| >>secondly, the variable needs to
| >>be declared global both inside and outside of the function if they are
| >>to share the same scope.
| >
| >
| > It seems that the PHP documentaion disagrees with you
| > http://www.php.net/global
| >
| > Both examples works (if removing the $ infront of global in example 1)
| >
| >
|
| Wow, I didn't know that. So all those commands declaring global
| variables outside functions were redundant... well, you never quit
learning.

while i too was about to say 'you're wrong', i do still tend to put 'global'
with variables i know i'll be using else where, if nothing else but to give
some kind of hint to the other developers that it is called within other
scopes - i.e. they may see it in a function though not passed in.

i completely avoid globals as they are very uninformative to other
developers (or myself after not working with a piece of code for a while).
and, while globals are effectively the same as a static interface on a class
object, at least that interface has a definitive structure with related
logic that will keep me from changing a property to something that is
completely invalid outside of local scope.

but that's just my 0.02 usd.

 

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

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