Burhan Khalid wrote: > Greg Wiley wrote: >> Funny you should ask this because I've been meaning to share some >> code that I wrote a few months ago that does exactly this for any >> day of the week. >> >> Please feel free to use this and make changes. I'd appreciate any >> changes/bug fixes being sent back to me though. >> > [ snip ] >> function num_days ($day, $month, $year) >> { > [ snip ] > > One tip that I would add is that instead of using individual > arguments, you might want to consider using an array as an argument. > This prevents people from inserting the arguments in the wrong order, > which would not yield the correct results. > > Function call would be : > > $my_date = array(); > $my_date['day'] = "Mon"; > $my_date['month'] = "Jan"; > $my_date['year'] = "2003"; > > num_days($my_date); > > Of course the indexes could be in any order, as long as they have day, > month, year as keys. > > Just a thought, good work though :) > > -- > Burhan Khalid > phplist[at]meidomus[dot]com > http://www.meidomus.com
You could also put the input values in dropdown menus, at least day and month. That way you make sure the input to the funtion is correct everytime. Cristian -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php