php代码
//获取 某个月的最大天数(最后一天)
function getMonthLastDay($month, $year) {
switch ($month) {
case 4 :
case 6 :
case 9 :
case 11 :
$days = 30;
break;
case 2 :
if ($year % 4 == 0) {
if ($year % 100 == 0) {
$days = $year % 400 == 0 ? 29 : 28;
} else {
$days = 29;
}
} else {
$days = 28;
}
break;
default :
$days = 31;
break;
}
return $days;
}
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号