How to count date difference excluding weekend and holidays in Computed Field How to count date difference excluding weekend and holidays?

I should count the number of days between two dates but the weekends and holidays must be excluded from the counting. I used Computed Field. 

$start_date_value = array_pop(field_get_items($entity_type, $entity, 'field_date_from'));

$end_date_value = array_pop(field_get_items($entity_type, $entity, 'field_date_to'));

$start_date = new DateObject($start_date_value['value'], '');

$end_date = new DateObject($end_date_value['value'], '');

$entity_field[0]['value'] =$start_date-&gt;difference($end_date, 'days');


Here is my working code for counting the days.
why would you try something like this,

create a variable array that contain all the Hollidays

$currentyear=the current year;
$holiday['01-01-'.$currentyear,other holiday,other holiday];

$result=$start_date-&gt;difference($end_date, 'days');
for(ctr=0;ctr=sizeof(holiday);ctr++;)
{
    if(holiday[ctr]&gt;=start_date &amp;&amp; holiday[ctr]&lt;=end_date)
    temp++;

} 
$result -= temp;