php获取某年某月的天数 【转】

function days_in_month($month, $year) {
    // calculate number of days in a month
    return $month == 2 ? ($year % 4 ? 28 : ($year % 100 ? 29 : ($year % 400 ? 28 : 29))) : (($month - 1) % 7 % 2 ? 30 : 31);
}

echo days_in_month(2,2014);

输出:28

 

转自:http://www.cnblogs.com/freespider/p/3545885.html

posted @ 2015-05-04 14:04  nemo20  阅读(159)  评论(0编辑  收藏  举报
访客数:AmazingCounters.com
2016/05/17 起统计