I'm writing a price calculator where weekends have a special price. To do this I need to know how many weekends there are between 2 dates.
Note that by a weekend, I mean if they want to have thursday to tuesday, the saturday and the Sunday are not 2 days with a weekend rate, but 1 weekend with a single rate. Thus for Thursday -> Tuesday, that would be a count of 1 weekend.
For Saturday -> Saturday that would be a count of 2 weekends, as the first saturday is not the same weekend as the following saturday. The same would also be true of Sunday to Sunday, it is counting weekends, regardless of whether they are full weekends, or partial weekends. As long as some or any portion of the weekend falls within that date range, it counts as 1 weekend. The best analogy I can think of is to consider the weekend a single day that lasts 48 hours, not 2 that last 24.
So, how would I determine how many 'whole or partial weekends' there are between 2 dates in php?