0
I have a spreadsheet that receives several values on the same line, they can both be filled or only one of the values filled. So for example:
Coluna | A | B | C |
Valor | 56,00 | 48,00 | 50,00 | (menor valor = 48,00)
Valor | 10,00 | | | (menor valor = 10,00)
Valor | 20,00 | | 22,00 | (menor valor = 20,00)
Valor | | 15,00 | 17,00 | (menor valor = 15,00)
Where empty space is empty even in excel.
I tried to take the lowest value in the following ways
$valor_coluna_a = $field[0]; //equivale a coluna A
$valor_coluna_b = $field[1]; //equivale a coluna B
$valor_coluna_c = $field[2]; //equivale a coluna C
$menor_valor = 999999;
if($valor_coluna_a < $menor_valor){
$menor_valor = $valor_coluna_a;
}
else if($valor_coluna_b < $menor_valor){
$menor_valor = $valor_coluna_b;
}
else if($valor_coluna_c < $menor_valor){
$menor_valor = $valor_coluna_c;
}
In this attempt above, what I imagined that I could get the lowest value in a correct way does not occur, what the error of this logic?