0
Is there a way to execute a Range of values for each case when using a switch statement?
<?php $passmark = 100; switch ($passmark) { case 80: echo "Fairly done"; break; case 90: echo "Nice"; break; case 95: echo "Good"; break; case 100: echo "Very Good"; break; default: echo "Below passmark"; } ?>
2 ответов
+ 2
<?php
$value = 56;
switch ($value){
case $value < 10:
echo "fair";
break;
case $value > 9 && $value < 25:
echo " good";
break;
case $value > 24:
echo "nice";
break;
}
0
Thank you so much. Am really learning alot through this Q&A discussion forum.