Skip to content

Instantly share code, notes, and snippets.

@bfodeke
Created December 20, 2016 19:06
Show Gist options
  • Save bfodeke/d607a15beb2b51464bf1e86ac657021c to your computer and use it in GitHub Desktop.
Save bfodeke/d607a15beb2b51464bf1e86ac657021c to your computer and use it in GitHub Desktop.
<?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