프로그래밍/PHP
(PHP) if ~ else if ~ else<-> switch~case
길가다주운노트
2016. 7. 10. 19:52
if 문
1 2 3 4 5 6 7 8 | <?PHP if($a == 'c') print "Continued...<br>"; else if($a == 's') print "Selected...<br>"; else print "Mistyped...<br>"; ?> | cs |
switch 문
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | <?php $a = 'c'; switch($a) { case 'c': print "Continued...<br>"; break; case 's': print "Selected...<br>"; break; default: print "Mistyped...<br>"; break; } ?> |