Jump to content

Multiple ors


yeshuawatso

Recommended Posts

Yes.
[code]
if ($a == $b || $c == $d || $e == $f) { echo "an expression returned true" };
[/code]
[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]I know my other option is using else ifs,[/quote]
Or's aren't quite the same as else() if() in that they will only ever be able to execute the same code based on a condition.,
Link to comment
https://forums.phpfreaks.com/topic/10321-multiple-ors/#findComment-38476
Share on other sites

[!--quoteo(post=376620:date=May 24 2006, 11:22 AM:name=Yeshua Watson)--][div class=\'quotetop\']QUOTE(Yeshua Watson @ May 24 2006, 11:22 AM) [snapback]376620[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Ok, this works for different variables, but does the same function work for the same variable?

[code]if($a == $b || $a == $c ||etc.){return true or false or whatever I need it to do here.}[/code]
[/quote]

yes that will work but make sure you get you logic right or you will run into errors
Link to comment
https://forums.phpfreaks.com/topic/10321-multiple-ors/#findComment-38528
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.