Php add 5 working days to current date excluding weekends (sat-sun) and excluding (multiple) holidays
<p>For delivery of our webshop, we need to calculate 5 working days from the current date in php.</p>

<p>Our working days are from monday to friday and we have several closing days (holidays) which cannot be included either.</p>

<p>I've found this script, but this doesn't include holidays.</p>

<pre><code>&lt;?php 

    $_POST['startdate'] = date("Y-m-d");
    $_POST['numberofdays'] = 5;

    $d = new DateTime( $_POST['startdate'] );
    $t = $d-&gt;getTimestamp();

    // loop for X days
    for($i=0; $i&lt;$_POST['numberofdays']; $i++){

        // add 1 day to timestamp
        $addDay = 86400;

        // get what day it is next day
        $nextDay = date('w', ($t+$addDay));

        // if it's Saturday or Sunday get $i-1
        if($nextDay == 0 || $nextDay == 6) {
            $i--;
        }

        // modify timestamp, add 1 day
        $t = $t+$addDay;
    }

    $d-&gt;setTimestamp($t);

    echo $d-&gt;format('Y-m-d'). "\n";

?&gt;
</code></pre>