Home > Backend Development > PHP Problem > How to use php cal_days_in_month function

How to use php cal_days_in_month function

藏色散人
Release: 2023-02-22 19:50:01
Original
3508 people have browsed it

php cal_days_in_month function is used to return the number of days in a month for the specified year and calendar. Its syntax is cal_days_in_month(calendar,month,year).

How to use php cal_days_in_month function

php How to use cal_days_in_month function?

Definition and usage

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

Syntax

cal_days_in_month(calendar,month,year);
Copy after login

Parameters

calendar Required. Specifies the calendar to be used. See PHP Calendar constants.

month Required. Specifies the month in the selected calendar.

year Required. Specifies the year in the selected calendar.

Return Value: Returns the number of days in the selected month for the given year and calendar.

PHP Version: 4.1

Example

Get the number of days in a month for the specified year and calendar:

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

The above is the detailed content of How to use php cal_days_in_month function. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
php
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template