当前位置: 代码迷 >> 综合 >> PHP第三天 switch
  详细解决方案

PHP第三天 switch

热度:73   发布时间:2023-10-11 03:50:32.0
<?php
$year = 2001;
$moth = 2;
switch ($moth) {case '1':echo "{$moth}月有31天";break;case '2':if($year%4 == 0 && $year%100  != 0 || $year%400 ==0 ){echo "{$year}年的{$moth}有29天";}else{echo "{$year}年的{$moth}有28天";}break;default:echo "请输入正确的月份";break;
}
?>

 

  相关解决方案