Error I can not find in a while loop with counter

1

I've been thinking about this code for a while, and I can not find the error. If someone can help me, I will be very grateful.

The problem is that the meter does not auto-subsume. I tried with $ c ++ and it did not add up, so I had to change it to $ c = $ c + 1, which is the same, and this one works for me. But in spite of everything it still does not work, because to the next return it returns to be the value of the counter 0.

// Si el string $month Y el string $year no estan vacios    
if(!empty($month) && !empty($year)){

       $c=0;
       //Buscalos dos strings en la array $dates
       while( !in_array( strtolower($exists), $dates) ): ?>

         //Si no estan en la array imprime por pantalla la etiqueta option con los valores de los string $year y $month 
         <option value="<?= $month ?>-<?= $year ?>"><?= $month ?> <?= $year ?></option>

         //Añademe en un solo string las variables $year y $string a la array dates para poder seguir comparando y buscando en las siguientes iteraciones. Ya que todo este bloque esta dentro de un while     
         <?php $dates[$c]= strtolower($month.' '.$year); 

         $c=$c+1;

        endwhile; 

     } ?>
    
asked by PiP 29.05.2018 в 16:40
source

0 answers