Mailinglisten-Archive |
Hallo Liste, da mußte ich einfach mal ein bißchen basteln: <? $MONTH = 1; $YEAR = 2001; function return_past_months($current_month, $current_year, $max) { $months = array(0 => "Januar", 1 => "Februar", 2 => "März", 3 => "April", 4 => "Mai", 5 => "Juni", 6 => "Juli", 7 => "August", 8 => "September", 9 => "Oktober", 10 => "November", 11 => "Dezember"); $re_month = array(); $current_month-=2; $current_year+= $current_month / 12; $current_month+=(12*((int) ($max / 11) + 1)); for($i = 0; $i < $max; $i++) { $re_months[$i]["MONTH"] = $months[(($current_month - $i) % 12)]; $re_months[$i]["YEAR"] = (int) ($current_year - ($i / 12)); } return $re_months; } $past_months = return_past_months($MONTH, $YEAR, 3); for ($i = 0; $i < sizeof($past_months); $i++) { echo $past_months[$i]["YEAR"].": "; echo $past_months[$i]["MONTH"]."<br>"; } ?> Gruß, Leo
php::bar PHP Wiki - Listenarchive