note 44116 added to function.checkdate

From: Date: Thu, 15 Jul 2004 12:52:21 +0000
Subject: note 44116 added to function.checkdate
Groups: php.notes 
Request: Send a blank email to php-notes+get-73294@lists.php.net to get a copy of this message
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; } } ---- Manual Page -- http://www.php.net/manual/en/function.checkdate.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+44116 Delete -- http://master.php.net/manage/user-notes.php?action=delete+44116&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+44116&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#73294) next »