mosi Posted July 11, 2007 Share Posted July 11, 2007 Just a quick question. If I have an if statement which goes "if ((a == b) && (c==d) && (e==f))" if a != b does it still check the other two parts to the statement or not? I know it won't really make much difference if any to load times but I was just curious. Link to comment https://forums.phpfreaks.com/topic/59530-if-statement-order-which-things-are-checked/ Share on other sites More sharing options...
pedrobcabral Posted July 11, 2007 Share Posted July 11, 2007 http://pt2.php.net/manual/en/language.operators.logical.php Take a look at the first table. Pretty explanatory. Link to comment https://forums.phpfreaks.com/topic/59530-if-statement-order-which-things-are-checked/#findComment-295808 Share on other sites More sharing options...
Caesar Posted July 11, 2007 Share Posted July 11, 2007 Yes it does. All the statements would need to prove true in that case. Only time it wouldn't, would be if your conditional statemt looked like.... <?php if(($a == $b) || ($a == $c) || ($a== $d)) { //DO THIS HERE } ?> Link to comment https://forums.phpfreaks.com/topic/59530-if-statement-order-which-things-are-checked/#findComment-295810 Share on other sites More sharing options...
teng84 Posted July 11, 2007 Share Posted July 11, 2007 if (a == b && c==d && e==f) that is proper if you have the && it should true all the statement if one is false then all is like false meaning the condition is not satisfy but if (a == b || c==d || e==f) if one of the statement here is write its like everything is right hope that helps Link to comment https://forums.phpfreaks.com/topic/59530-if-statement-order-which-things-are-checked/#findComment-295814 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.