"; $calendar .= "$monthName $year"; $calendar .= ""; // Create the calendar headers foreach($daysOfWeek as $day) ( $calendar .= "$day"; ) // Create the rest of the calendar // Initiate the day counter, starting with the 1st. $currentDay = 1; $calendar .= ""; // The variable $dayOfWeek is used to // ensure that the calendar // display consists of exactly 7 columns. if ($dayOfWeek > 0) ( $calendar .= " "; ) $month = str_pad($month, 2, "0", STR_PAD_LEFT); while ($currentDay <= $numberDays) ( // Seventh column (Saturday) reached. Start a new row. if ($dayOfWeek == 7) ( $dayOfWeek = 0; $calendar .= ""; ) $currentDayRel = str_pad($currentDay, 2, "0", STR_PAD_LEFT); $date = "$year-$month-$currentDayRel"; $calendar .= "$currentDay"; // Increment counters $currentDay++; $dayOfWeek++; ) // Complete the row of the last week in month, if necessary if ($dayOfWeek != 7) ( $remainingDays = 7 - $dayOfWeek; $calendar .= " "; ) $calendar .= ""; $calendar .= ""; return $calendar; ) ?>
Kullanım
İçinde bulunduğunuz ayın takvimini oluşturun: