You are here: Re: global variables, Apache, PHP4.4.1Win32, WinXP « PHP Programming Language « IT news, forums, messages
Re: global variables, Apache, PHP4.4.1Win32, WinXP

Posted by Jim Carlock on 02/01/06 02:27

"Al" <alexrussell101@gmail.com> wrote:
> Just use global $counter_file; in your function.
> See http://uk2.php.net/global#language.variables.scope.global for
> usage.
>
> The global keyword will basically open up the variable for use
> by your function. An alternative:
>
> $counter_file = $GLOBALS["counter_file"];
>
> but that creates a local copy. However,
>
> $counter_file = &$GLOBALS["counter_file"];
>
> creates a read/writable reference like the global keyword.
> That way you can call it whatever you like.

Thanks Alex (or Al).

Breaking out of old global variable ways is going to be interesting.
What an interesting way to handle global variables.

Is there a way to require variable pre-declarations? Where the
parsing unit throws up an error if a variable is not predeclared?

For instance, the .asp ways and means...

Option Explicit
Dim sCounterFile
sCounterFile = "counter.txt"

Thanks for explaining "global" and "GLOBALS[]".

Jim Carlock
Post replies to the newsgroup.

 

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

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