Reply to Re: Variable scope mystery

Your name:

Reply:


Posted by Oli Filth on 11/18/05 19:29

Maarten said the following on 18/11/2005 17:28:
> Yes, that's it! So, a variable declared inside a function isn't available
> inside nested function even while you are calling it in (global). You'll
> have to declare it global in the main function first. This can cause
> problems though, as there might be a variable with the same name outside the
> main function that you do not want to access. See what I mean? The solution
> is obvious of course, but sometimes you just don't know what variables live
> out there, do you?
>

I think the solution is: Don't use global variables!

Always explicitly pass required variables to functions.

--
Oli

[Back to original 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

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