The cal_days_in_month() function returns the number of days in a month for a specified year and calendar.
Syntax
cal_days_in_month(calendar,month,year);
Parameters
calendar − The calendar to be used.
month − The month to be specified.
year − The year to be specified.
Return
The cal_days_in_month() function returns the number of days in a month for a specified year and calendar.
Example
The following is an example −
<?php $res = cal_days_in_month(CAL_GREGORIAN, 3, 2018); echo "$res days"; ?>
Output
31 days