Change PHP7 Each gives me warning

0

Hello, I have inherited a web in php, when I change to PHP7, I get it:

Warning: Variable passed to each() is not an array or object

I want to paint a table with the schedules for each day of the week. When it has data, the past value paints the schedule well. But since the change of PHP7, when there is no value before I left it blank and now I get the Warning. I've been going around for days and there's no way to find a solution.

for ($i=1; $i<=5; $i++ ){   // paso por 5 dias laborables
   ?>
                    <td valign="top">
                        <?php
    while  (list ($dia, $valor)= each($setmana[$i])) {
                                    ?>

                    <p id="<?=$valor['lloc']?>">
                        <?=$valor['hores']?> <br />
                       <?php

               switch($valor['lloc']){

                           case 'CTE':  $text = "1 - Barcelona";
                               $llegenda_cte = 1;
                             break;
                   case 'FCJ':  $text = "2 - Madrid";
                               $llegenda_ccat = 1;
                             break;
                   case 'FCEP':  $text = "3 - Bilbao";
                               $llegenda_fcep = 1;  
                             break;     
                   case 'SBP':  $text = "4 - Sevilla";
                               $llegenda_sbp = 1;
                             break;
                           case ' ': $text= " ";
                              $llegenda_null=1;
                               break;
                 }          
        ?>
                        <small><?=$text?></small></p>
     <?php
      }
    ?>
         </td>
     <?php
            }
                        ?>
    
asked by Marc 08.06.2018 в 14:03
source

0 answers