function nbWeekInAYear ($year) { $nbWeek = date('W',mktime(0, 0, 0, 12, 31, $year)); if ($nbWeek==1) { $nbWeek = 52; } return $nbWeek; } echo nbWeekInAYear(2009)."\n"; //53 echo nbWeekInAYear(2010)."\n"; //52 echo nbWeekInAYear(2011)."\n"; //52 echo nbWeekInAYear(2012)."\n"; //52 echo nbWeekInAYear(2013)."\n"; //52 echo nbWeekInAYear(2014)."\n"; //52 echo nbWeekInAYear(2015)."\n"; //53 echo nbWeekInAYear(2016)."\n"; //52
Aucun commentaire:
Enregistrer un commentaire