循环中的日期更改

Hi I've created an array that has a Start Date that increases by a month and this happens by how many months there are. So if my StartDate was 10/10/15 and placed 3 into my for loop I would receive 10/10/15 10/11/15 10/12/15 10/01/16. My current problem is that I've added a new while loop to find out if some of the days of the months fall on either a Saturday or Sunday.Which I don't want I would like it to fall on a weekday. So ive created this loop and it works however I have another problem. If 10/11/15 fell on a Sunday my loop will change it to 11/11/15 Monday which is correct but the rest of dates after it will now follow the changed date example be 11/12/15, 11/01/16.

I want it change the date but still the other dates to still increase from the startdate (10/10/15) like 10/10/15, 11/11/15, 10/12/15, 10/01/16. How would I do this? I also understand some of my code may not be the best but I am just a beginner. Any help would be much appreciated.

$date = "2015-10-1"; //startdate
$lol = 2; //length of loan
$start = strtotime($date); //startdate
$currentdate = $start;



echo "<pre>";
$times_table = [];
$titles[] = [
    'Version' => 'Version 5 ',
    'Date' => 'Feb-16',
    'Name' => 'gary',
    'RandNum' => '80',
    'PaymentType' => 'P',
    'dtType' => 'Q',

];


$times_table = [];
for($i = 0; $i <= ($lol + 1) ; $i++){
    $times_table[$i]['StartDate']=  $date   ;
    $times_table[$i]['Version']=  "v10" ;

    $cur_date = date("M-y-D", $currentdate);
    $times_table[$i]['DtMy']= "<strong>" . $cur_date . "</strong>" ;


            $mthYr = date("M", $currentdate);
            $nxtmth = " ";

// Loop that changes the day to a weekday   
    while($nxtmth != "Y" ) {

        if( $cur_date = date("M", $currentdate) !== $mthYr){

            $nxtmth = "Y";
            $currentdate = strtotime('-1 days', $currentdate);
            $cur_date = date("d-M", $currentdate);
            $times_table[$i]['DtMy']= "<strong>" . $cur_date . "</strong>" ;


           }


          if ($cur_date = date("w", $currentdate) == 0 || $cur_date = date("w", $currentdate) == 6){

             if ($nxtmth == "Y"){

                 $currentdate = strtotime('-1 day', $currentdate);
                 $cur_date = date("d-M", $currentdate);
                 $times_table[$i]['DtMy']= "<strong>" . $cur_date . "</strong>" ;

                    }       

             else{

                 $currentdate = strtotime('+1 day', $currentdate);  
                 $cur_date = date("d-M", $currentdate);
                 $times_table[$i]['DtMy']= "<strong>" . $cur_date . "</strong>" ;

                 }
             if(($cur_date = date("M", $currentdate)) !== $mthYr){

                 $nxtmth = "Y";
                 $currentdate = strtotime('-1 day', $currentdate);
                 $cur_date = date("d-M", $currentdate);
                 $times_table[$i]['DtMy']= "<strong>" . $cur_date . "</strong>" ;

                }        


            }

        if($cur_date = date("w", $currentdate) > 0 && $cur_date = date("w", $currentdate) < 6 ){
                     $cur_date = date("d-M", $currentdate);
                    $times_table[$i]['DtMy']= "<strong>" .  $cur_date . "</strong>" ; 
                    break;
        }


    }  


        $currentdate = strtotime('+1 month', $currentdate); //Adds 1 month



} 


print_r($times_table);

echo "</ pre>";

You can simply store the value in temp variable before overwriting

<?php
$date = "2015-10-1"; //startdate
$lol = 2; //length of loan
$dates = [];
for($i = 0; $i <= ($lol + 1) ; $i++){
    $rawDate = strtotime($date);
    $tmpRawDate = $rawDate;
    $day    = date('N', $rawDate);
    // check if date is sat or sun

    if($day == 6 || $day == 7)
        $rawDate = strtotime($date . ' +'.(8 - $day).' day');

    $dates[] = date('Y-m-d', $rawDate);
    $rawDate = $tmpRawDate;

    $rawDate = strtotime($date . ' +1 month');
    $date = date('Y-m-d', $rawDate);
}
echo '<pre>';
print_r($dates);

Demo: https://eval.in/494664

UPDATE

<?php
$date = "2015-10-1"; //startdate
$lol = 2; //length of loan
$start = strtotime($date); //startdate
$currentdate = $start;

echo "<pre>";
$titles[] = [
    'Version' => 'Version 5 ',
    'Date' => 'Feb-16',
    'Name' => 'gary',
    'RandNum' => '80',
    'PaymentType' => 'P',
    'dtType' => 'Q',
];

$times_table = [];
for($i = 0; $i <= ($lol + 1) ; $i++){
    // store the start date in tmp variable.
    $tmpStart = $start;
    // get the day counter 0 for monday .. 6 for sunday
    $day    = date('N', $start);

    $times_table[$i]['StartDate']=$date;
    $times_table[$i]['Version']="v10";

    // check for sat and sun, if found increment to next monday
    if($day == 6 || $day == 7)
        $start = strtotime(' +'.(8 - $day).' day', $start);

    $times_table[$i]['DtMy']= "<strong>" . date("d-M", $start) . "</strong>";

    // restore the original variable
    $start = $tmpStart;

    // Increment one month
    $start = strtotime('+1 month', $start);
}

print_r($times_table);