Re: Do PHP boolean operators short circuit?

From: Date: Sat, 20 Sep 2003 02:57:33 +0000
Subject: Re: Do PHP boolean operators short circuit?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-163265@lists.php.net to get a copy of this message
Dan Anderson wrote:
I am learning perl and my book describes "boolean short circuiting". Basically: function1() OR function2(); (function2 never is evaluated if function1 is true). Will this work in PHP for any function?
Yes. From my experience, it will work that way. I don't know if it's that way for every version or not, though. Same thing for AND, too... function1() AND function2() If function1() comes out FALSE, then function2() isn't evaluated. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals – www.phparch.com

« previous php.general (#163265) next »