As others pointed out, you cannot use such a switch, but how to define it like this:
<? $level = 21; $answers = array('low', 'low-to-moderate', 'moderate', 'moderate-to-high', 'high'); echo $answers[intval(($level-1)/20)]; ?>
Note If $ level = 0 , then the expression inside intval () will be -1/20 > , which is less than -1 and therefore will be rounded to 0 .
Maiku mori
source share