Re: Lazy evaluation?
| From: | Jimmy | Date: | Wed, 16 Jan 2002 15:34:06 +0000 |
| Subject: | Re: Lazy evaluation? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-80728@lists.php.net to get a copy of this message | ||
>> For "or" statements it does, but not && or xor.
Are you sure only "or" which do lazy evaluation?
as far as i remember, the last time I use "&&" operator it do
lazy evaluation.
And if you look at the online manual, some users also confirmed
that PHP implement lazy evaluation for logical operator.
http://www.php.net/manual/en/language.operators.logical.php
>> I don't know about you, but I wouldn't want lazy evaluation on
>> a conditional statement involving "and".
Would you share the reason with us why you dont want lazy
evaluation in "AND"?
> if i have a statement like
> if (($a == 'a') && ($b == 'b')) blahblahblah();
> and, $a != 'a'.
> why should php even look at the value for $b while evaluating this line?
i believe PHP implement lazy evaluation, so it won't evaluate $b=='b'
--
Jimmy
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Success only comes before work in the dictionary.