On Sat, 2012-03-10 at 20:38 -0500, Tedd Sperling wrote: > On Mar 10, 2012, at 12:20 PM, Maciek Sokolewicz wrote: > > > function getAmountOfDaysInAMonth($month, $year) { > > $days = array(31, (($year%4==0 and ($year%100 > 0 or $year%400==0)) ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); > > return $days[$month+1]; > > } > > I like that -- here's a small variation. > > function numberDaysMonth($month, $year) > { > // Leap year is definded as a year that is evenly divisible by four > // AND (year NOT evenly divisible by 100 OR year IS evenly divisible by 400) > > $feb = ($year%4 == 0 && ($year%100 != 0 || $year%400 == 0) ) ? 29 : 28; > $days = array(0, 31, $feb, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); > return $days[$month]; > } > > Cheers, > > tedd > > _____________________ > tedd.sperling@xxxxxxxxx > http://sperling.com > > > > > > I still don't see what's wrong with date("t"); -- Thanks, Ash http://www.ashleysheridan.co.uk