<? # PHP : switch with multiple case # Author : adi@riswan.com echo "| X | Y | "; echo "--------- "; for ($x=1;$x<=5;$x++) { switch ($x) { case 1 : case 4 : $y = 'A'; break; case 2 : case 5 : $y = 'B'; break; case 3 : $y = 'C'; break; } echo "| $x | $y | "; } ?>and the result will be :
| X | Y |
---------
| 1 | A |
| 2 | B |
| 3 | C |
| 4 | A |
| 5 | B |
No comments:
Post a Comment
Leave your comments with attitude please. This blog does DOFOLLOW :-)