HDFilmMaker2112 Posted November 20, 2011 Share Posted November 20, 2011 Just looking to know if this is the proper way to implement this: I need the below if to be true when any number between 100 and 1000 is the value of x, including say "105.55" if($x>= 100 && $x <= 1000){ } Basically I'm asking will a value of x with a decimal in it not cause the if statement to be true. Quote Link to comment Share on other sites More sharing options...
Fadion Posted November 20, 2011 Share Posted November 20, 2011 Why not try it in the first place? <?php $x = 105.55; if ($x >= 100 && $x <= 1000) { echo 'x is within range'; } ?> Be it an integer or a float, if it's within the range, it will return true. Dead simple! Quote Link to comment 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.