jason360 Posted February 4, 2015 Share Posted February 4, 2015 Hey guys, I am not sure how to do a proper range in my if statement. I need a range where count is between 1 and 10. I am using this statement below, but it is just considering the $count<=10 and 0 is included in this statement. I require a different function for $count = 0. Thanks in advance! if ($count <= 10 && $count >= 1) Link to comment https://forums.phpfreaks.com/topic/294389-number-range-in-if-statement/ Share on other sites More sharing options...
QuickOldCar Posted February 4, 2015 Share Posted February 4, 2015 if ($count <= 10 && $count >= 0){ if($count == 0){ //handle the 0 } else { //handle 1 to 10 } } Link to comment https://forums.phpfreaks.com/topic/294389-number-range-in-if-statement/#findComment-1504901 Share on other sites More sharing options...
Psycho Posted February 4, 2015 Share Posted February 4, 2015 Or, if ($count == 0){ //handle the 0 } elseif ($count >= 1 && $count<=10) { //handle 1 to 10 } Link to comment https://forums.phpfreaks.com/topic/294389-number-range-in-if-statement/#findComment-1504904 Share on other sites More sharing options...
jason360 Posted February 4, 2015 Author Share Posted February 4, 2015 Thanks Psycho and QuickOldCar! Link to comment https://forums.phpfreaks.com/topic/294389-number-range-in-if-statement/#findComment-1504906 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.