cal_info(cal_int);
Here cal_int is an integer to identify the type of calendar required. Here are the values
0 : CAL_GREGORIAN ( Gregorian Calendar )
1 : CAL_JULIAN ( Julian Calendar )
2 : CAL_JEWISH ( Jewish Calendar )
3 : CAL_FRENCH ( French Revolutionary Calendar )
Here is an example of displaying all information about Julian Calendar
$a=cal_info(1);
foreach($a as $key => $val) {
echo "$key -> $val <br>";
foreach($val as $key1 => $val1) {
echo "$key1 -> $val1 <br>";
}
}
The Output is here
months -> Array
1 -> January
2 -> February
3 -> March
4 -> April
5 -> May
6 -> June
7 -> July
8 -> August
9 -> September
10 -> October
11 -> November
12 -> December
abbrevmonths -> Array
1 -> Jan
2 -> Feb
3 -> Mar
4 -> Apr
5 -> May
6 -> Jun
7 -> Jul
8 -> Aug
9 -> Sep
10 -> Oct
11 -> Nov
12 -> Dec
maxdaysinmonth -> 31
calname -> Julian
calsymbol -> CAL_JULIAN
This is a two dimensional array so we have used two while loops to display all information. If we don't give any calendar number then by default all calendars will be returned. Here it will be a three dimensional array. Here is a sample code.
<table><tr><td valign=top>
$a=cal_info();
while (list ($key, $val) = each ($a)) {
echo "$key -> $val <br>";
while (list ($key1, $val1) = each ($val)) {
echo "$key1 -> $val1 <br>";
while (list ($key2, $val2) = each ($val1)) {
echo "$key2 -> $val2 <br>";
}
}
echo "</td><td valign=top>";
}
echo "</td><td valign=top>";
DEMO of cal_info() is displayed
Author
🎥 Join me live on YouTubePassionate about coding and teaching, I publish practical tutorials on PHP, Python, JavaScript, SQL, and web development. My goal is to make learning simple, engaging, and project‑oriented with real examples and source code.