PHP cal_days_in_month() function

PHP usort() function
PHP cal_from_jd function

In this article, you will learn how to get the number of days in the month of a certain year. The cal_days_in_month() function returns the number of days of the given month and the given year of the calendar.

What is the syntax of the cal_days_in_month() function in PHP?

cal_days_in_month(calendar,month,year);
ParametersDetails
calendarThe calendar to follow – Required
monthThe month (numeric number) – Required
yearThe specific year to consider the month in – Required
PHP cal_days_in_month() function

Examples of cal_days_in_month() function

Example 1. Get the number of days for the specified month, year and calendar.

<?php
$days=cal_days_in_month(CAL_GREGORIAN,01,2021);
echo "Days in January 2021: " $days;
?>
PHP usort() function
PHP cal_from_jd function
en English
X
Scroll to Top