|
Posted by Thomas Mlynarczyk on 11/29/06 11:32
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
Navigation:
[Reply to this message]
|