|
Posted by NC on 11/28/06 21:47
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
Navigation:
[Reply to this message]
|