You are here: Re: what is the meaning « PHP Programming Language « IT news, forums, messages
Re: what is the meaning

Posted by Jerry Stuckle on 11/29/06 13:03

Thomas Mlynarczyk wrote:
> Also sprach Jerry Stuckle:
>
>
>>>$someArray = array('field1' => 1, 'field2' => 'two');
>
>
>>>$someArray = array();
>>>$someArray['field1'] = 1;
>>>$someArray['field2'] = 'two';
>
>
>>Actually, the second option is perfectly valid. It's fine to assign
>>to an array element which hasn't been defined yet. Just don't try to
>>USE an array element (or any other variable) before it's been defined.
>
>
> Come to think of it:
> $GLOBALS['notDefinedYet']
> and
> global $notDefinedYet
>
> The first would give a notice, the second one not. I thought I had read
> something about this difference in the manual, but can't find it again.
>
> Also, I have heard about a security issue concerning $GLOBALS: that in some
> versions of PHP, it is (was?) possible to overwrite the complete array by
> passing a request parameter 'GLOBALS' to the script. Would the global
> keyword also be concerned here?
>
> Greetings,
> Thomas
>
>
>

$GLOBALS['notDefinedYet'] = $x;

will not give a notice.

$x = $GLOBALS['notDefinedYet'];

will. See the difference?


And

global($notDefinedYet);

Doesn't actually use the value. It just declares it to be global.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

 

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

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