Posted by Oli Filth on 05/25/05 20:45
Kimmo Laine wrote:
> $var0 = "";
> $var1 = "bunny";
> $default = "default";
<...SNIP...>
> $target = $var0 OR $var1 OR $default;
> echo $target; //outputs bunny
No it doesn't. The result is an empty string.
> Why "bunny"? Seems that using or the operand is assigned into $target, and
> if it's true, it halts. It is evaluated like this:
>
> (($target = $var0) || $target = $var1) || $target = $default;
No it's not. The line is evaluated as:
($target = $var0) || $var1 || $default;
--
Oli
[Back to original message]
|