Returns the number of week-days between two valid dates.
function weekdays_tween($sdate,$edate) {
$from_date = strtotime($sdate);
$to_date = strtotime($edate);
$days = 0;
while ($from_date < $to_date) {
$from_date = strtotime('+1 day', $from_date);
$day = date('D', $from_date);
if ($day == 'Sun') {
continue;
}
++$days;
}
return $days;
}