I needed to do a bunch of range based cases in a Drupal module, i ended up coming up with this...

switch(true) {
    case in_array($val, range(0, 200)):
        $amount = $val * 2.50;  
        break;
    case in_array($val, range(201, 500)):
        $amount = $val * 2.00;
        break;
 .....
Back