Backend Development 3 min read

PHP cal_info Function: Returns Calendar Information

The cal_info() PHP function returns detailed information about a specified calendar—including month names, abbreviations, maximum days, and identifiers—or all supported calendars when no argument is given, with usage examples and output illustrated.

Laravel Tech Community
Laravel Tech Community
Laravel Tech Community
PHP cal_info Function: Returns Calendar Information

cal_info() is a PHP function that returns information about a selected calendar.

The function returns an array containing calendar name, code, months, month abbreviations, and the maximum number of days in a month. If no calendar argument is provided, information for all supported calendars is returned.

Supported calendar identifiers are:

0 or CAL_GREGORIAN – Gregorian Calendar

1 or CAL_JULIAN – Julian Calendar

2 or CAL_JEWISH – Jewish Calendar

3 or CAL_FRENCH – French Revolutionary Calendar

Parameter:

calendar : the calendar to query; omitted to retrieve all calendars.

Return value: an array with keys such as months , abbrevmonths , maxdaysinmonth , calname , and calsymbol , providing month names, abbreviations, maximum days, and identifiers.

Example usage:

<?php
$info = cal_info(0);
print_r($info);
?>

The printed array shows month names from January to December, their abbreviations, the maximum days (31), the calendar name “Gregorian”, and the symbol CAL_GREGORIAN .

backenddocumentationfunctioncalendar
Laravel Tech Community
Written by

Laravel Tech Community

Specializing in Laravel development, we continuously publish fresh content and grow alongside the elegant, stable Laravel framework.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.