Last active
December 19, 2015 19:59
-
-
Save ericjsilva/6010423 to your computer and use it in GitHub Desktop.
Created this script after seeing a post about October having 5 Mondays, 5 Tuesdays, and 5 Wednesdays and it was the first time it would occur in 400 years or something stupid like that. The script starts at the current year and decrements down to the $endYear value and will print out all years in which October has 5 Mondays, Tuesdays, and Wednes…
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function checkOctober() { | |
$endYear = 1800; | |
$currentYear = intval(date("Y")); | |
for ($i = $currentYear; $i >= $endYear; $i--) { | |
$d = strtotime("01 October ".$i); | |
$w = date("w", $d); | |
if ($w == 1) { | |
echo date("Y", $d) . "<br/>"; | |
} | |
} | |
} | |
function determineIfFirstIsMonday($y) { | |
} | |
?> | |
<html> | |
<title>October 1st Test</title> | |
<body> | |
<h1>October 1st Test</h1> | |
<p>The following years had October 1st occurring on a Monday.</p> | |
<p>This means that there were 5 Mondays, 5 Tuesdays, and 5 | |
Wednesdays in the month of October that year.</p> | |
<?php checkOctober(); ?> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment