Home >Backend Development >PHP Tutorial >cal_days_in_month() function in PHP

cal_days_in_month() function in PHP

WBOY
WBOYforward
2023-09-18 11:29:02876browse

cal_days_in_month() function in PHP

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

grammar

cal_days_in_month(calendar,month,year);

parameter

  • calendar - The calendar to use.

  • Month - The month to specify.

  • year - The year to specify.

return

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

Example

The following is an example -

Live Demo

<?php
   $res = cal_days_in_month(CAL_GREGORIAN, 3, 2018);
   echo "$res days";
?>

Output

31 days

The above is the detailed content of cal_days_in_month() function in PHP. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete