I want to find the total number of specific days between two dates. I need a proper solution for future usage, I want to use any start date and end date in the future.

My Code

```
$start_date       = new DateTime('2020/10/01');
$end_date         = new DateTime('2020/10/31'); 
$days = array('Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday');
$diff = $start_date->diff($end_date, true)->days;
foreach ($days as $key => $value) {
   $number_of_days = intval($diff / 7) + ($start_date->format('N') + $diff % 7 >= $key+1);
   $result[$value] = $number_of_days;
}

```

result

```
Array
(
    [Monday] => 5
    [Tuesday] => 5
    [Wednesday] => 5
    [Thursday] => 5
    [Friday] => 5
    [Saturday] => 5
    [Sunday] => 5
)

```

Expecting Result

```
Array
(
    [Monday] => 4
    [Tuesday] => 4
    [Wednesday] => 4
    [Thursday] => 5
    [Friday] => 5
    [Saturday] => 5
    [Sunday] => 4
)

```