- floor: documentation ( source)
- date: documentation ( source)
- strtotime: documentation ( source)
<?php
function daysBetween($start_date, $end_date, $weekDay) {
$first_date = strtotime($start_date." -1 days");
$first_date = strtotime(date("M d Y",$first_date)." next ".$weekDay);
$last_date = strtotime($end_date." +1 days");
$last_date = strtotime(date("M d Y",$last_date)." last ".$weekDay);
return floor(($last_date - $first_date)/(7*86400)) + 1;
}
print daysBetween("DEC 13 2005", "DEC 26 2005", "Monday");