At 12:02 2002.05.12, Jos� Nyimi wrote:

>Hello All,
>
>Could you explain this syntax please ?
>
>$x ||= $y || '';
>
>Thanks,
>
>Jos�.
>

$a ||= $b is the same as $a = $a || $b;

So your exmaple translate to 

$x = $x || $y || '';

This, I think, means that $x take the value of $y if $x is false (undefined , 0 or an 
empty string). If $y is also false, $x takes the empty string value.

The || operate is a short-circuit meaning that it stop resolving the chain as soon as 
it finds a True value. This has the effect that the first true value will be result of 
the whole thing.

Hope this helps.


>---------------------------------
>Yahoo! Mail -- Une adresse @yahoo.fr gratuite et en fran�ais !

----------------------------------------------------------
�ric Beaudoin               <mailto:[EMAIL PROTECTED]>


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to