title: Calculate week time between dates in php
body: <p>I have two days:</p>
  <pre><code>$from = &quot;2021-08-02&quot;;
  $to = &quot;2021-08-15&quot;;
  $weekDiff = ceil(abs(strtotime($startDate) - strtotime($endDate)) / 60 / 60 / 24 / 7);
  </code></pre>
  <p>I got the number of weeks starting from Monday.
  But I have a problem I want help with.</p>
  <p>If I choose <code>$from = &quot;2021-08-03&quot;</code> for Tuesday or $from = &quot;2021-08-04&quot; for Wednesday, then i want it to default to monday <code>$from = &quot;2021-08-02&quot;</code>.
  If I select $form = &quot;2021-08-05&quot; as a Thursday, I want it to start from Thursday to Sunday. Thanks</p>