switch command for string value : switch statement « Statement « PHP
- PHP
- Statement
- switch statement
switch command for string value
<?php
$choice = "Rock";
switch ($choice){
case "Pop":
print "Pop not Rock";
break;
case "Rap":
print "Rap and not Rock";
break;
case "Jazz":
print "Jazz not Rock";
break;
case "Rock":
print "Rock music";
break;
}
?>
Related examples in the same category