Switch to full style
:read: Start PHP with us. Includes topics to help you in php
Post a reply

switch command for string value

Mon Oct 27, 2008 5:58 pm

Code:
<?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;
  }
  
?>




Post a reply
  Related Posts  to : switch command for string value
 recursive string reversal- reverse string     -  
 check if string ends with specific sub-string in php     -  
 Splitting a String Based on a Found String     -  
 check if string start with a specific sub-string in PHP     -  
 Switch vs Hub     -  
 php switch     -  
 JavaScript switch example     -  
 network switch     -  
 Use Switch with strings     -  
 java switch example     -  

Topic Tags

PHP Basics