note 44116 deleted from function.checkdate by tomsommer
| From: | tomsommer@php.net | Date: | Thu, 15 Jul 2004 15:11:49 +0000 |
| Subject: | note 44116 deleted from function.checkdate by tomsommer | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-73301@lists.php.net to get a copy of this message | ||
Note Submitter: dzcowart@gmail.com
----
In response to goochivasquez's note, you don't need to iterate over every day in the month
to determine the last day. Here's a simpler way to do it:
function last_day_of_month ($month, $year) {
if ( checkdate($month, 31, $year) ) { return 31; }
if ( checkdate($month, 30, $year) ) { return 30; }
if ( checkdate($month, 29, $year) ) { return 29; }
if ( checkdate($month, 28, $year) ) { return 28; }
}