How to include the end date in a DatePeriod? : <p>I am trying to get a Date range for all workdays this week. I have written the following code to do so.</p>

<h3>Code</h3>

<pre><code>$begin = new DateTime('monday this week'); 2016-07-04
$end = clone $begin;
$end-&gt;modify('next friday'); // 2016-07-08

$interval = new DateInterval('P1D');
$daterange = new DatePeriod($begin, $interval, $end);



foreach($daterange as $date) {
    echo $date-&gt;format('Y-m-d')."&lt;br /&gt;";
}
</code></pre>

<h3>Output</h3>

<ul>
<li>2016-07-04</li>
<li>2016-07-05</li>
<li>2016-07-06</li>
<li>2016-07-07</li>
</ul>

<p>In the output friday is missing. I can fix this by doing <code>$end-&gt;modify('next saturday')</code> but I was wondering why the last day of a <code>DatePeriod</code> is not included in the range.</p>
