note 43107 added to function.checkdate

From: Date: Wed, 09 Jun 2004 21:15:47 +0000
Subject: note 43107 added to function.checkdate
Groups: php.notes 
Request: Send a blank email to php-notes+get-70558@lists.php.net to get a copy of this message
Since no month (to my knowledge) has less than 28 days start counting from 28 instead of 0. Might save a little time. Or just quit calculating things that you already know: function last_day_of_month( $month, $year ){ if($month==2){ if( checkdate(2, 29, $year) ) return 29; else return 28; }else{ switch($month){ case 1: return 31; case 3: return 31; case 4: return 30; case 5: return 31; case 6: return 30; case 7: return 31; case 8: return 31; case 9: return 30; case 10: return 31; case 11: return 30; case 12: return 31; } } } ---- Manual Page -- http://www.php.net/manual/en/function.checkdate.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+43107 Delete -- http://master.php.net/manage/user-notes.php?action=delete+43107&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+43107&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#70558) next »