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]
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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.