1 <?php 2 $num1 = 1; 3 $num2 = 2; 4 function int($num){ 5 switch($num){ 6 case 1: 7 case 2: 8 echo "1或2"; 9 break; 10 default: 11 echo "1和2都不是"; 12 break; 13 } 14 } 15 int($num1);//1或2 16 int($num2);//1或2 17 18 ?>