You are here: Re: global variables « PHP Programming Language « IT news, forums, messages
Re: global variables

Posted by Oliver Grätz on 02/14/07 23:58

Toby A Inkster schrieb:
>
> What most other languages refer to as "globals" PHP calls "superglobals".
> There's no way to define superglobals though -- PHP defines a few on its
> own (depends on your version, but in recent ones, $_POST, $_GET, $SERVER,
> $_SESSIOM, $_ENV, $_FILES and $GLOBALS) and you're stuck with them.
>
> Although I steer away from globals (in my current project, over 4000 lines
> of PHP so far, and not a single global!), sometimes I really would
> appreciate having a method of defining superglobals. Not going to happen
> though. :-(

I intentionally left out elaborating about the nature of the globals vs
superglobals because use of global variables is somewaht discouraged.
Even Zend tells developers to use static class variables instead. And by
the way, Defining your own superglobals is NOT impossible. You CAN use
the runkit extension (http://de.php.net/runkit) to define variables as
superglobals. But the nature of this extension as "sandbox" should tell
developers not to do so ;-) But if you find _good_ reasons to use your
own superglobals, you are free to do so.

OLLi

 

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

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