Forum Moderators: coopster

Message Too Old, No Replies

logical operators

does php check all the statements even if one is false?

         

sned

7:14 pm on Apr 3, 2006 (gmt 0)

10+ Year Member



Say I have an if statement:

if($x && $y){
// do stuff
}

If $x is false, will php go ahead and check $y anyway? Or will it skip the if condition and not check $y at all since the return will be false?

Thanks!
-sned

jatar_k

8:36 pm on Apr 3, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



I am assuming they follow order of precedence [php.net] and are always evaluated in order, as soon as one is not true it will move on

sned

9:15 pm on Apr 3, 2006 (gmt 0)

10+ Year Member



Ahh, thanks for the link .. I've been looking all over for something like that.

-sned