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"; } ?>

10th May 2019, 2:08 PM
Samuel Kinuthia
Samuel Kinuthia - avatar
2 odpowiedzi
+ 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; }
10th May 2019, 9:15 PM
Jônatas Araripe
Jônatas Araripe - avatar
0
Thank you so much. Am really learning alot through this Q&A discussion forum.
11th May 2019, 4:34 AM
Samuel Kinuthia
Samuel Kinuthia - avatar