Advertisement
touhid_xml

PHP Switch basic

Feb 9th, 2014
423
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. $n= 15;
  3.  
  4. switch($n){
  5. case 1:
  6.     echo "The number is: 1";
  7.     break;
  8. case 2:
  9.     echo "The number is: 2";
  10.     break;
  11. case 3:
  12.     echo "The number is: 3";
  13.     break;
  14. case 4:
  15.     echo "The number is: 4";
  16.     break;
  17. case 5:
  18.     echo "The number is: 5";
  19.     break;
  20. case 6:
  21.     echo "The number is: 6";
  22.     break;
  23. case 7:
  24.     echo "The number is: 7";
  25.     break;
  26. case 8:
  27.     echo "The number is: 8";
  28.     break;
  29. case 9:
  30.     echo "The number is: 9";
  31.     break;
  32. case 10:
  33.     echo "The number is: 10";
  34.     break;
  35. default:
  36.     echo "Nothing matched";
  37.  
  38. }
  39.  
  40.  
  41.  
  42. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement