Pre 5.3 Solution:
$start = $current = strtotime('2011-02-07');
$end = strtotime('+10 weeks', $start);
$months = array();
while($current < $end) {
$month = date('M', $current);
if (!isset($months[$month])) {
$months[$month] = 0;
}
$months[$month]++;
$current = strtotime('+1 weekday', $current);
}
print_r($months);
Output ( codepad ):
Array
(
[Feb] => 16
[Mar] => 23
[Apr] => 11
)
source
share