Introduction
In this article I explain the "cal_days_in_month()" function in PHP. This function returns the number of the days in a month for the given year and calendar.
Use of this function
You can easily determine how many days are in the month and you can determine the days of any month.
Syntax
| Cal_days_in_month(calendar , month , year); |
| Parameter | Description |
| Calendar | Calendar to use for calculation. |
| Month | Month in select calendar. |
| Year | Year in select calendar. |
Returns the length in days of the selected month in the given calendar.
Example
- <?php
- $cal = cal_days_in_month(CAL_GREGORIAN, 5, 2013);
- echo "There was $cal days in may 2013";
- ?>
Output
Example
- <?php
- $cal = cal_days_in_month(CAL_GREGORIAN, 11, 2011);
- echo "There was $cal days in november 2011";
- ?>
Output
Next I will explain how many days are in the month without using any calendar and determine the days used by the date function. But you will use these techniques to determine the current days of the month.
Example


Vinod KumarPosted Apr 9, 2016, 11:18 AM
thankyou
Kuppurasu NagarajPosted Apr 9, 2016, 10:49 AM
Nice