Advertisement
ujiajah1

switch_php

Aug 20th, 2016
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.41 KB | None | 0 0
  1. $i = 5;
  2.  
  3. switch ($i) {
  4.         case 0:
  5.             echo '$i bernilai 0.';
  6.             break;
  7.         case 1:
  8.         case 2:
  9.         case 3:
  10.         case 4:
  11.         case 5:
  12.             echo '$i bernilai diantara 1 dan 5.';
  13.             break;
  14.         case 6:
  15.         case 7:
  16.             echo '$1 bernilai 6 atau 7.';
  17.             break;
  18.         default:
  19.             echo "Saya tidak tahu nilai dari \$i.";
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement