You are here: Re: [PHP] Super globals ? « PHP « IT news, forums, messages
Re: [PHP] Super globals ?

Posted by "Wong HoWang" on 10/19/24 11:24

yes, I am asking how to start my own super global...
And even a PHP beginner know that $GLOBALS is a array containing all the
global variables and it is used in a function or a class. So I think no one
will ask a question here which the answer is simply $GLOBALS.

Any finally, thanks Jasper for the answer.

"Jasper Bryant-Greene" <jasper@bryant-greene.name>
wrote:43071D3D.5060603@bryant-greene.name...
> Kevin Waterson wrote:
>> This one time, at band camp, Jasper Bryant-Greene
>> <jasper@bryant-greene.name> wrote:
>>
>>
>>>Because he asked for superglobals, not globals. $GLOBALS (not $_GLOBALS)
>>
>> meh, force of habit
>>
>>>happens to be an example of a superglobal.
>>
>>
>> and variable can be set within its scope, so why not use it?
>> As we see in the manual at $GLOBALS _is_ a super global and available
>> to all scopes within the script.
>> http://www.php.net/manual/en/reserved.variables.php#reserved.variables.globals
>> it refers to $GLOBALS as " This is a 'superglobal', or automatic global,
>> variable. "
>>
>> gotta love the php manual
>
> Exactly Kevin. What the OP wanted was to create another superglobal, just
> like $GLOBALS. The contents of $GLOBALS refer to the global variables,
> which are *not* all superglobals. The only superglobals by default in PHP
> (apart from $GLOBALS) are $_SERVER, $_GET, $_POST, and so on.
>
> He asked a question, and I provided the answer. Why he wants to do it is
> another question, but telling him to "use $GLOBALS" isn't answering his
> question, it's answering a different question, namely how to access the
> global variables.
>
> Jasper

 

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

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