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. 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 } 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. 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. Link to comment https://forums.phpfreaks.com/topic/68361-real-quick-if-question/#findComment-343797 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.