Re: what is the meaning
- From: "NC" <nc@xxxxxxxxx>
- Date: 28 Nov 2006 13:47:18 -0800
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
.
- References:
- what is the meaning
- From: sam
- Re: what is the meaning
- From: BKDotCom
- Re: what is the meaning
- From: Thomas Mlynarczyk
- what is the meaning
- Prev by Date: Re: When to quote?
- Next by Date: Re: php 5 classes: public, protected and private
- Previous by thread: Re: what is the meaning
- Next by thread: Role-based Access Control (RBAC)
- Index(es):
Relevant Pages
|