PHP gets the last day of the month function sharing, php gets the last day of the month
A very simple and practical function, no more nonsense here, just provide the code
Copy code The code is as follows:
/**
* * Date-get the last day of the month
* @return int
*/
Public function get_lastday() {
If($this->month==2) {
$lastday = $this->is_leapyear($this->year) ? 29 : 28;
} elseif($this->month==4 || $this->month==6 || $this->month==9 || $this->month==11) {
$lastday = 30;
} else {
$lastday = 31;
}
return $lastday;
}
/**
* * Date-whether it is a leap year
* @return int
*/
Public function is_leapyear($year) {
return date('L', $year);
}
The above is the entire content of this code, I hope you guys like it.
http://www.bkjia.com/PHPjc/951638.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/951638.htmlTechArticle Sharing function of getting the last day of the month in php, a very simple and practical function to get the last day of the month in php, not much nonsense here Yes, directly submit the code to copy the code as follows: /** * Day...