Stephen68 Posted February 9, 2009 Share Posted February 9, 2009 Ok I was just wondering if there was a better way to write an if statement with a lot of or's in it. e.g. if (!$field == "month" || $field == "day" || $field == "deadline_year" || $field == "submit2" || $field == "submit33") Thanks for helping Stephen Link to comment https://forums.phpfreaks.com/topic/144487-solved-help-with-ors-in-if-statment/ Share on other sites More sharing options...
unkwntech Posted February 9, 2009 Share Posted February 9, 2009 Aside from being a bit hard to read that is pretty much it, you could do this: if (!$field == "month" || $field == "day" || $field == "deadline_year" || $field == "submit2" || $field == "submit33") if you find that easier to read then go for it, but what you posted is my preference. Link to comment https://forums.phpfreaks.com/topic/144487-solved-help-with-ors-in-if-statment/#findComment-758165 Share on other sites More sharing options...
Stephen68 Posted February 9, 2009 Author Share Posted February 9, 2009 Ok thanks just wanted to make sure before I went to far into what I'm doing Thanks again Stephen Link to comment https://forums.phpfreaks.com/topic/144487-solved-help-with-ors-in-if-statment/#findComment-758169 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.