I am trying to make a function that would return all given days of a given month or a year. For instance I wanted to get all Mondays in a given month/year OR I wanted to get all Saturdays for a given month / year...
Function would be something like:
function getDaysOfMonth($month, $year, $day_of_week) {
// $month = 1 - 12
// $year = 2010, etc
// $day_of_week = 1,2,3, etc (1 for Monday, 2 for Tuesday, 7 for Sunday)
......
}
I'm puzzled by a "good way" to do this. If possible I only want the loop within the function to execute 5 times (as there would be most 5 "Mondays or Tuesdays, etc" in a given week. I can do this if I loop though the entire month but don't want it looping 30+ times... Hope someone can help,
Adam