marcus Posted October 18, 2006 Share Posted October 18, 2006 Ok, what I'm trying to do is if the user specifies like an answer between 1 - 10, 11 - 20, 21 - 30... etc... that it will echo off something according to the valued answer[code]$rounded = round($answer);if($rounded == 50 - 60){echo "something here";};[/code] Quote Link to comment Share on other sites More sharing options...
LazyJones Posted October 18, 2006 Share Posted October 18, 2006 Not sure what you are trying to achieve, but I'll try...Forget rounding[code]if($answer > 10 && $answer < 21) {echo "Answer is between 10 and 20";} [/code] Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted October 18, 2006 Share Posted October 18, 2006 Here is a simple script that illustrates one method:[code]<?php$x = $_GET['a'];switch (true) { case ($x<10): $a = 'less than 10'; break; case ($x>10 && $x<20): $a = 'between 10 and 20'; break; default: $a = '20 or larger';}echo $x . ' is ' . $a;?>[/code]Ken 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.