I'm looping through the days of the week and checking an array for each day. I can output existing/matching values but when there is no corresponding value I can't output a single zero I output the 3 zeroes if there are 3 items in the array. How can I output a single zero? Here is my code:

```
$day1='9-9-2019';
$day2='9-10-2019';
$day3='9-11-2019';
$day4='9-12-2019';
$day5='9-13-2019';
$day6='9-14-2019';
$day7='9-15-2019';

$records = array(
    array(
        "date_sub" => "9-11-2019",
        "timeSum" => "99:00:00"
    ),
    array(
        "date_sub" => "9-12-2019",
        "timeSum" => "01:40:00"
    ),
    array(
        "date_sub" => "9-13-2019",
        "timeSum" => "00:20:00"
    )
);

for ($i = 1 ; $i < 8; $i++) {

    if ($i==1) { // is there anything for monday?

        foreach ($records as $row) {

            $date_sub=$row["date_sub"];
            $timeSum=$row["timeSum"];

            if ($date_sub==$day1) {echo "$date_sub: $timeSum";} else {echo "$day1: 0:00";}
        }
    }

    if ($i==2) { // is there anything for tuesday?

        foreach ($records as $row) {

            $date_sub=$row["date_sub"];
            $timeSum=$row["timeSum"];

            if ($date_sub==$day2) {echo "$date_sub: $timeSum";} else {echo "$day2: 0:00";}
        }
    }

    if ($i==3) { // is there anything for wednesday?

        foreach ($records as $row) { 

            $date_sub=$row["date_sub"];
            $timeSum=$row["timeSum"];

            if ($date_sub==$day3) {echo "$date_sub: $timeSum";} else {echo "$day3: 0:00";}
        }
    }

    if ($i==4) { // is there anything for thursday?

        foreach ($records as $row) { 

            $date_sub=$row["date_sub"];
            $timeSum=$row["timeSum"];

            if ($date_sub==$day4) {echo "$date_sub: $timeSum";} else {echo "$day4: 0:00";}
        }
    }

    if ($i==5) { // is there anything for friday?

        foreach ($records as $row) { 

            $date_sub=$row["date_sub"];
            $timeSum=$row["timeSum"];

            if ($date_sub==$day5) {echo "$date_sub: $timeSum";} else {echo "$day5: 0:00";}
        }
    }

    if ($i==6) { // is there anything for saturday?

        foreach ($records as $row) { 

            $date_sub=$row["date_sub"];
            $timeSum=$row["timeSum"];

            if ($date_sub==$day6) {echo "$date_sub: $timeSum";} else {echo "$day6: 0:00";}
        }
    }

    if ($i==7) { // is there anything for sunday?

        foreach ($records as $row) {

            $date_sub=$row["date_sub"];
            $timeSum=$row["timeSum"];

            if ($date_sub==$day7) {echo "$date_sub: $timeSum";} else {echo "$day7: 0:00";}
        }
    }
echo "<br />\n";
}

```

Am I on the right track or do I need to restructure my code?