Fonction PHP – Nombre de jours dans le mois
Description
Fonction retournant le nombre de jours dans un mois.
Source
<?php /** * Fonction retournant le nombre de jours dans un mois. * @param integer $month Mois de 1 à 12 * @param integer $year Année * @return integer Nombre de jours */ function maxDaysInMonth($month, $year) { $days = cal_days_in_month(CAL_GREGORIAN, $month, $year); return $days; } ?>
Exemple
<?php echo maxDaysInMonth(02, 2012); // Affiche 29 ?>
Commentaires récents