4
I have the variable $peso
ranging from 1000 to 50000 (grams)
There is a table of freight I have as
1000a2000 => 10,00
2000a3000 => 20,00
...
9000a10000 => 100,00
kg_adicional => 2,25
Have ifs up to 10000(grams), above that I should calculate the additional value, for example
$peso = 18000
I have to take the value of 9000a10000 (R$ 100,00) and add another 8 KG, but I don’t know how to break this variable and do the validation.
How is your table ? How do you pull this data ? Array ?
– Diego Souza
(KG - MAXIMUM VALUE) * 2,25.
– Diego Souza
What do you mean
quebrar
?– rray
You speak of breaking "9000a10000" (for example), into two variables or an array with size 2?
– akira-ito
if ($weight>10000) { $total = 100+ ($weight-10000)*2.25}. Your question is in the formula??
– emanuelsn