- mktime: documentation ( source)
- date: documentation ( source)
<?php
// In the beginning there are no Sundays counted yet
$number_of_sundays = 0;
// Make the following actions for all years of the twentieth century
for ($year = 1900; $year <= 1999; $year++) {
//Make the following actions for all months from January to December
for ($month = 1; $month <= 12; $month++) {
// Get Unix Timestamp of the current month and year on the first day of the month
$current_date = mktime(0, 0, 0, $month, 01, $year);
$get_day_of_week = date("D", $current_date);
echo $year . ", " . $month . ": " . $get_day_of_week."\n";
}
}