Created
December 20, 2016 19:06
-
-
Save bfodeke/d607a15beb2b51464bf1e86ac657021c to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
$months = array( | |
'January' => 31, | |
'February' => 28, | |
'March' => 31, | |
'April' => 30, | |
'May' => 31, | |
'June' => 30, | |
'July' => 31, | |
'August' => 31, | |
'September' => 30, | |
'October' => 31, | |
'November' => 30, | |
'December' => 31, | |
); | |
$year = 2017; | |
foreach ($months as $month => $days) { | |
for ($i = 0; $i < $days; $i++) { | |
$date = $month . " " . ($i + 1) . ", 2017"; | |
$dayofweek = date('w', strtotime($date)); | |
// If the day isn't Sunday or Saturday. | |
// This assumes that Sunday is the first day of | |
// week. | |
if ($dayofweek != 0 && $dayofweek != 6) { | |
print $date . "\n"; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment