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 01:57

NC wrote:
> Thomas Mlynarczyk wrote:
>
>>>sam wrote:
>>>
>>>>What is the meaning of this operator:-
>>>>=>
>>>
>>>Assignment - used in arrays?
>>
>>Hm. But why the need for a special operator here? Wouldn't
>>a simple = have done the job just as well?
>
>
> Yes, but you'd have to write it differently.
>
> Consider this simple example:
>
> $someArray = array('field1' => 1, 'field2' => 'two');
>
> If it equivalent to:
>
> $someArray = array();
> $someArray['field1'] = 1;
> $someArray['field2'] = 'two';
>
> Moreover, the second option might trigger an E_NOTICE, since
> you would be trying to assign a value to a not-yet-defined member
> of the array...
>
> Cheers,
> NC
>

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.

--
==================
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

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