views:

39

answers:

1

Hello!

How can I print (echo) the days of an unknown month if month and year are parameters?

Thank you.

+1  A: 

To get the number of days in a given month of a given year you can use cal_days_in_month

echo cal_days_in_month(CAL_GREGORIAN, 10, 2010); // prints 31
codaddict
Haha, brilliant. Thank you. I need this to improvise a special kind of calendar that only shows some days etc.
Francisc
PHP really has a function for everything, doesn't it? i would have suggested using the date function and using the days-in-month format char... but this is easier.
Mark
Yeah, it seems it does, haha.
Francisc