Jump to content

multiple if() in one statement


meltingpoint

Recommended Posts

This works:

if($ABC == 'Yes' and $X != $Y){
echo "Error";
exit();
}

 

I need to evaluate one more set of variables in this statement like so;

 

This does not work:

if($ABC == 'Yes' and $X != $Y or $Z != $Y){
echo "Error";
exit();
}

 

So basically I need to echo an error if $ABC == Yes and both $X and $Z do not equal $Y

 

If gives an error because it is obviously not correct.  I do not know how to make it correct.  Any suggestions?

Link to comment
https://forums.phpfreaks.com/topic/255923-multiple-if-in-one-statement/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.