cal_days_in_month


php apg

RETURNS the number of days in a month for a given calendar.



<?php

int cal_days_in_month 
int $calendar 
                                      
int $month 
                                      
int $year )


where,

$calendar The calendar to determine the number of days in month
                   
SEE the below TABLE )

$month The selected month

$year 
The selected year

?>

 $calendar 

CONSTANT VALUE MEANING
CAL_GREGORIAN 0 Proleptic Gregorian calendar
CAL_JULIAN 1 Julian calendar
CAL_JEWISH 2 Jewish calendar
CAL_FRENCH 3 French Repuclican calendar
ed48


 $month 


The selected month.



 $year 


The selected year.



  1 EXERCISE   

<?php

$year01 
mt_rand(20002040);
$cal01 cal_info(CAL_GREGORIAN);

?>
<table width="100%" border="1" cellspacing="5" cellpadding="5">
 <tbody><tr><td colspan="2"><?php echo 'Year = ' $year01 ' (CAL_GREGORIAN)'?></td></tr>
<tr> <td >MONTH NAMES</td>    <td >DAYS</td>  </tr>

<?php

for ($g01 1$g01<=12$g01++)
{
$mthds01 cal_days_in_month(CAL_GREGORIAN$g01$year01);
?>
   <tr> <td><?php echo $cal01['months'][$g01]; ?></td>
    <td><?php echo $mthds01?></td>  </tr>
<?php
}

?>
<tr><td colspan="2">ed48</td></tr></tbody></table>


  2 EXERCISE   

<?php

$year02 
1500;
$cal02 cal_info(CAL_JULIAN);

?>
<table width="100%" border="1" cellspacing="5" cellpadding="5">
<tbody><tr> <td colspan="2"><?php echo 'Year = ' .  $year02 '&nbsp;&nbsp;(CAL_JULIAN)'?></td></tr>
<tr> <td>MONTH NAMES</td><td>DAYS</td></tr>
<?php

for ($g02 1$g02<=12$g02++)
{
$mthds02 cal_days_in_month(CAL_JULIAN$g02$year02);
?>
   <tr> <td><?php echo $cal02['months'][$g02]; ?></td>
    <td><?php echo $mthds02?></td>  </tr>
<?php
}

?>
<tr><td colspan="2">ed48</td></tr></tbody></table>


  3 EXERCISE   

<?php

$year03 
mt_rand(57785781);
$cal03 cal_info(CAL_JEWISH);

?>
<table width="100%" border="1" cellspacing="5" cellpadding="5">
<tbody><tr><td colspan="2"><?php echo 'Year = ' $year03 ' (CAL_JEWISH)'?></td></tr>
<tr> <td>MONTH NAMES</td><td>DAYS</td>  </tr>
<?php

for ($g03 1$g03<=13$g03++)
{
$mthds03 cal_days_in_month(CAL_JEWISH$g03$year03);
?>
<tr> <td><?php echo $cal03['months'][$g03]; ?></td>
<td><?php echo $mthds03?></td>  </tr>
<?php
}

?>
<tr><td colspan="2">ed48</td></tr></tbody></table>


  4 EXERCISE   

<?php

$year04 
mt_rand(111);
$cal04 cal_info(3); 
// CAL_FRENCH

?>
<table width="100%" border="1" cellspacing="5" cellpadding="5">
<tbody><tr><td colspan="2"><?php echo 'Year = ' $year04 ' (3)'?></td></tr>
<tr> <td>MONTH NAMES</td><td>DAYS</td></tr>
<?php

for ($g04 1$g04<=13$g04++)
{
$mthds04 cal_days_in_month(3$g04$year04);
?>
<tr> <td><?php echo $cal04['months'][$g04]; ?></td>
<td><?php echo $mthds04?></td>  </tr>
<?php
}

?>
<tr><td colspan="2">ed48</td></tr></tbody></table>