Aureole Posted September 7, 2007 Share Posted September 7, 2007 Is there a way to have "or" in an if statement...like...I know you can have "and" like if(this && this) but I'm not sure on this one... <?php if($this == "this" OR $that == "that") { // Do this... } ?> If so how do I do it? Thanks a lot. Quote Link to comment https://forums.phpfreaks.com/topic/68361-real-quick-if-question/ Share on other sites More sharing options...
Fadion Posted September 7, 2007 Share Posted September 7, 2007 U can have whatever logical operator u wish and OR is one: if($this == '1' or $that == '2'){ //do smth } or if($this == '1' || $that == '2'){ //do smth } Quote Link to comment https://forums.phpfreaks.com/topic/68361-real-quick-if-question/#findComment-343733 Share on other sites More sharing options...
Aureole Posted September 7, 2007 Author Share Posted September 7, 2007 So "|| and "OR" are the same? Well I didn't know that, thanks a lot. Mind you I didn't even know "OR" was an operator. Quote Link to comment https://forums.phpfreaks.com/topic/68361-real-quick-if-question/#findComment-343782 Share on other sites More sharing options...
Fadion Posted September 7, 2007 Share Posted September 7, 2007 yeah lol it actually OR is a logical operator. Look at this page for a listing of the logical operators. Quote Link to comment https://forums.phpfreaks.com/topic/68361-real-quick-if-question/#findComment-343797 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.