PHP cal days in month() Function
Syntax
cal_days_in_month(calendar,month,year);
Parameter | Description |
Calendar | Specifies the calendar to use. Look at the PHP Calendar Constants (Required) |
Month | Specifies the month in the selected calendar (Required) |
Year | Specifies the year in the selected calendar (Required) |
Definition
It returns number of days in a month specified calendar and year.
Usage
It is used to count the total number of days in a particular month. Like February 2015 will have 28 days.
Example
<?php $a=cal_days_in_month(CAL_JULIAN,7,2014); echo "There was $a days in July 2014"; ?>
- Example
- Run
According to the above example we have seleted the JULIAN calendr, July month and 2014.
Note: All three parameters are required.
Syntax
<?php $a_day_b=cal_days_in_month(CAL_JEWISH,2,2019); echo "There was $a_day_b days in February 2019"; ?>
There will 29 days in February 2019
According to specified calender the days in February month will 29. You can run and check the exact output.