Calculating Business Days with PHP: Is this accurate?
<p><strong>BRIEFING:</strong></p>

<p>I'm trying to calculate the business days between two dates for a custom project management system I'm building. Here's what I made so far as shown below. It seems to be working fine but I'm not sure how accurate it is and whether I should use it or not. Any feedback would be much appreciated!</p>

<p><strong>CODE</strong></p>

<pre><code>&lt;?php

    # date variables:
    date_default_timezone_set('Asia/Kuwait');
    $date['start'] = date('Y-m-d H:i:s');
    $date['end'] = '2013-12-01 08:00:00';
    $date['off'] = array('Friday','Saturday'); # usual days off in Kuwait)

    # calculate the difference:
    $date_s = new DateTime($date['start']);
    $date_e = new DateTime($date['end']);
    $interval = $date_s-&gt;diff($date_e);

    # obtain relevant values:
    $remaining_days = $interval-&gt;format('%r%a');
    $remaining_weeks = floor($remaining_days/7);
    $weekend_days = ($remaining_weeks*count($date['off']));

    # additional holidays (just an example):
    $extra_holidays_array = array
    (
        'holiday 1' =&gt; '2013-06-24 00:00:00',
        'holiday 2' =&gt; '2013-06-25 00:00:00',
        'holiday 3' =&gt; '2013-07-01 00:00:00',
        'holiday 4' =&gt; '2013-08-24 00:00:00'
    );

    # check if a real holiday:
    $extra_holidays = 0;
    foreach( $extra_holidays_array as $check_date )
    {
        $day_of_holiday = date('l', strtotime($check_date));
        if( ! in_array($day_of_holiday,$date['off']) ){ $extra_holidays++; }
    }

    # total holidays:
    $total_holidays = ($weekend_days+$extra_holidays);

    # business days:
    $business_days_nh = ($remaining_days-$weekend_days); # NO extra holidays
    $business_days_wh = ($remaining_days-$weekend_days-$extra_holidays); # WITH extra holidays

?&gt;

&lt;ul&gt;
&lt;li&gt;Current Date: &lt;?php echo $date['start']; ?&gt;&lt;/li&gt;
&lt;li&gt;Deadline Date: &lt;?php echo $date['end']; ?&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;li&gt;Remaining Days: &lt;?php echo $remaining_days; ?&gt;&lt;/li&gt;
&lt;li&gt;Remaining Weeks: &lt;?php echo $remaining_weeks; ?&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;li&gt;Usual Holidays: &lt;?php echo $weekend_days; ?&gt;&lt;/li&gt;
&lt;li&gt;Extra Holidays: &lt;?php echo $extra_holidays; ?&gt;&lt;/li&gt;
&lt;li&gt;Total Holidays: &lt;?php echo $total_holidays; ?&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;li&gt;Business Days (Before Holidays): &lt;?php echo $business_days_nh; ?&gt;&lt;/li&gt;
&lt;li&gt;Business Days (After Holidays): &lt;?php echo $business_days_wh; ?&gt;&lt;/li&gt;
&lt;/ul&gt;
</code></pre>
