欢迎各位兄弟 发布技术文章

这里的技术是共享的

You are here

PHP获取 某个月的最大天数(最后一天) 有大用

本文讲解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;
}

来自  https://blog.csdn.net/wiozvptl/article/details/53350586

https://www.nuoweb.com/program/1872.html

http://www.php.cn/php-sourcecode-47276.html

https://www.jb51.net/article/70229.htm






普通分类: