tqla Posted January 4, 2009 Share Posted January 4, 2009 Hello. Here is my code to see if a variable is set and is numeric: if (isset($selected_section_content) && is_numeric($selected_section_content)) {} I want to add one more OR condition to this. I want to make the statement true if the variable is set, is numeric OR is "allow". Notice that "allow" in not numeric so it has to be an OR condition. ??? Quote Link to comment https://forums.phpfreaks.com/topic/139463-help-with-if-statment-syntax/ Share on other sites More sharing options...
premiso Posted January 4, 2009 Share Posted January 4, 2009 if ((isset($selected_section_content) && is_numeric($selected_section_content)) OR $allow) {} Quote Link to comment https://forums.phpfreaks.com/topic/139463-help-with-if-statment-syntax/#findComment-729538 Share on other sites More sharing options...
tqla Posted January 4, 2009 Author Share Posted January 4, 2009 Thanks premiso but that seems to state that the statement is true if: (it is set and is numeric) OR is allow I want it to be true if: it is set and (is numeric OR allow) You see what I mean? Quote Link to comment https://forums.phpfreaks.com/topic/139463-help-with-if-statment-syntax/#findComment-729543 Share on other sites More sharing options...
premiso Posted January 4, 2009 Share Posted January 4, 2009 ...change the parenthesis around. if (isset($selected_section_content) && (is_numeric($selected_section_content) OR $allow)) {} Quote Link to comment https://forums.phpfreaks.com/topic/139463-help-with-if-statment-syntax/#findComment-729544 Share on other sites More sharing options...
tqla Posted January 4, 2009 Author Share Posted January 4, 2009 ah ha! I understand. Thanks premiso! Quote Link to comment https://forums.phpfreaks.com/topic/139463-help-with-if-statment-syntax/#findComment-729547 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.