php判断某年某月有多少天

时间:2014-08-05 23:02:31   收藏:0   阅读:490
<?php
function yearMonthDays($year,$month){
	if (in_array($month, array(1, 3, 5, 7, 8, 01, 03, 05, 07, 08, 10, 12))) {  
		return ‘31‘;  
	}elseif ($month == 2){  
		if ($year % 400 == 0 || ($year % 4 == 0 && $year % 100 !== 0)) {        //判断是否是闰年  
			return ‘29‘;  
		}else{  
			return ‘28‘;  
		}  
	} else {  
		return ‘30‘;  
	}
}


php判断某年某月有多少天,布布扣,bubuko.com

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!