Finding How Many Days in a Month with PHP

I wrote an article about this before for JavaScript. We can easily do the same with PHP's calendar functions.

First, which function will we use and what are its parameters?

cal_days_in_month(calender, month, year);

calendar – there are certain constants that we will define for this. For example, the constant CAL_GREGORIAN is used for the Gregorian calendar that Turkey currently uses.

Now let's crown our article with an example;

$day = cal_days_in_month(CAL_GREGORIAN, 1, 1993);

echo '1993 January has '.$day.' days';
Comments

There are no comments, make the firs comment