This article describes how to obtain the maximum number of days (the last day) of a month in PHP. It involves php process control and mathematical computation related skills and has some reference value, for more information, see
This article describes how to obtain the maximum number of days (the last day) of a month in PHP. It involves php process control and mathematical computation related skills and has some reference value, for more information, see
This example describes how to obtain the maximum number of days of a month (the last day) by PHP. Share it with you for your reference. The details are as follows:
// Obtain the maximum number of days of a month (the last day) 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 ;}
I hope this article will help you with php programming.
,