This is the function I\'m trying to write:
function getWednesdays($month, $year) {
// Returns an array of DateTimes representing all Wednesdays this month
There's probably a more efficient way to do it, but this works:
You can test with this:
foreach (getWednesdays($argv[1], $argv[2]) as $date) {
echo date("Y-m-d\n", $date);
}
$ php wednesdays.php 11 2010
2010-11-03
2010-11-10
2010-11-17
2010-11-24
$ php wednesdays.php 12 2010
2010-12-01
2010-12-08
2010-12-15
2010-12-22
2010-12-29
$ php wednesdays.php 2 2012
2012-02-01
2012-02-08
2012-02-15
2012-02-22
2012-02-29
S