Re: Functional difference between OR and ||
>> There IS a functional difference: || is a "greedy" or (calculates both
>> inputs to determine the output, whereas the keyword or is a "lazy" or
>> that calculates one of the inputs and only the other one if necessary.
>> That is also the reason why the "or die()" construct works. If it
>> would always calculate both inputs, the die function would always be
>> called!
>
> Incorrect. Neither || nor && will evaluate the second operand if the
> first one determines the result of the expression.
>
Oops! I did not know that. I was sure I read it in the manual...
Thanks for the correction.
|