Re: Lazy evaluation?
| From: | Miles Thompson | Date: | Wed, 16 Jan 2002 15:29:38 +0000 |
| Subject: | Re: Lazy evaluation? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-80725@lists.php.net to get a copy of this message | ||
SHWLHAP! (Sound of dead fish hitting me in the side of the head.)
Of course - if the first condition is false, PHP doesn't bother to evaluate the second argument.
I was thinking that if the first condition is true I don't want evaluation to stop there.
Miles
At 08:18 AM 1/16/2002 -0700, mike cullerton wrote:
on 1/16/02 5:57 AM, Miles Thompson at milesthompson@ns.sympatico.ca wrote: For "or" statements it does, but not && or xor. I don't know about you, but I wouldn't want lazy evaluation on a conditional statement involving "and". i'm new to all this stuff, so i'll bite. hopefully someone can explain what i'm missing. 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? shouldn't the if fail after evaluating $a? thanks, mike -- mike cullerton michaelc at cullerton dot com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net