<?
function get_working_days($start_date, $end_date)
{
$start_ts = strtotime($start_date);
$end_ts = strtotime($end_date);
$working_days = 0;
$tmp_ts = $start_ts;
for ($i = 1; $i <= 7; $i++) {
$day[$i] = array();
}
while ($tmp_ts <= $end_ts) {
$tmp_day = date('D', $tmp_ts);
if (!($tmp_day == 'Sun') && !($tmp_day == 'Sat')){
$working_days++;
}
for ($i = 1; $i <= 7; $i++) {
$tmp_day_num = date('N', $tmp_ts);
if ($tmp_day_num == $i) {
$tmp_date_formatted = date('Ymd', $tmp_ts);
array_push($day[$i], $tmp_date_formatted);
}
}
$tmp_ts = strtotime('+1 day', $tmp_ts);
}
return $working_days;
}
$start = '13-06-2012';
$end = '27-06-2012';
get_working_days($start, $end);
?>