Jump to content

if statement - order which things are checked


mosi

Recommended Posts

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
Share on other sites

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.