0

hello I have problems with this line of the foreach where in my version php 5.6.40 it worked correctly

  line 22 --> foreach($valoresold as $campo => $valor){
        if($valor != $valoresnew[$campo] || !array_key_exists ($campo, $valoresnew )){
            if( !array_key_exists ($campo, $valoresnew ) ){

                if($valor != ''){
                    $acciones .= "<li><b>".ucfirst($campo)."</b>: $valor.</li>";
                }
            } else {
                $acciones .= "<li>the value <b>$campo</b> has been modified. old value: ".$valor." / new value: ".$valoresnew[$campo].".</li>";
            }
        }
    }
  • 5
    `$valoresold` most likely is not an array. `var_dump($valoresold);` before the foreach to see what it contains. – aynber Jun 10 '20 at 15:02
  • I get a null value –  Jun 10 '20 at 15:10
  • If you get null then It's not something you can iterate is it... Do an `if(is_array($valoresold))` before to make sure it only goes to the foreach with arrays – Andreas Jun 10 '20 at 15:16

0 Answers0