Jump to content

How would I do something like (if ($num == 1 to another number)


marcus

Recommended Posts

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]
Link to comment
Share on other sites

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
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.