PHP cal_days_in_month() Function

Definition

The cal_days_in_month() function returns the number of days in a month for a specified year.

Syntax

PHP cal_days_in_month() Function has the following syntax.

cal_days_in_month(calendar,month,year);

Parameter

PHP cal_days_in_month() Function has the following parameters.

ParameterIs RequiredDescription
calendarRequired.Calendar to use.
monthRequired.Selected Month
yearRequired.Selected year

Example

Returns the number of days in a month for a specified year


<?php
$d=cal_days_in_month(CAL_GREGORIAN,10,2012);
echo "There was $d days in October 2012";
?>

The code above generates the following result.





















Home »
  PHP Tutorial »
    Function reference »




PHP Array Functions
PHP Calendar Functions
PHP Class Functions
PHP Data Type Functions
PHP Date Functions
PHP File Functions
PHP Image Functions
PHP Math Functions
PHP MySQLi Functions
PHP SimpleXML Functions
PHP String Functions
PHP XML Functions
PHP Zip Functions