manalnor Posted October 25, 2011 Share Posted October 25, 2011 Hello dears, let say i've hits = 10000 and i'm using <? if ($line[hits]==1) { // something } else if($line[hits]==2) { // something else } else { // something else else }?> But i wanna say if $line[hits] is within range 1 to 10 show something else if $line[hits] is within range 11 to 20 show something else how to say it thanks Quote Link to comment https://forums.phpfreaks.com/topic/249801-if-something-is-within-renge/ Share on other sites More sharing options...
Zurev Posted October 25, 2011 Share Posted October 25, 2011 if ($line['hits'] < 10 || $line['hits'] > 1) Less than and greater than are your friends, the double pipe | means OR. http://php.net/manual/en/language.operators.logical.php Quote Link to comment https://forums.phpfreaks.com/topic/249801-if-something-is-within-renge/#findComment-1282194 Share on other sites More sharing options...
Pikachu2000 Posted October 25, 2011 Share Posted October 25, 2011 You would want to use && for that comparison. An OR will return TRUE for any value you give it . . . Quote Link to comment https://forums.phpfreaks.com/topic/249801-if-something-is-within-renge/#findComment-1282196 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.