3
Good morning, everyone,
I want to add values to a form, but I’m not getting it. I need to make the following calculation:
<?php
vlMateriaPrima = 3,05;
$isumosMateriais = 0,25;
$embalagem = 0,50;
$custoDireto = vlMateriaPrima + $isumosMateriais + $embalagem;
?>
These values must be filled in with a comma on the form. The result is to be 3.80 and comes out only 3
With comma it doesn’t add up, it needs to be with
.– Daniel Costa
Exchange the
,for.and then do the sum.– rray
Comma calculation in PHP and Correct pennies in Boletophp Bank Slips
– rray
Yeah, I tried to use "number_format($value,2,'.',')" to convert the variable, but from the following error "Notice: A non well Formed Numeric value encountered"
– GustavoSevero
I have the answer, but I couldn’t post.
– Sr. André Baill
http://pastebin.com/3xB3aadw here, try it this way.
– Sr. André Baill
Thanks @rray, closed! $vlMateriaPrima = str_replace(',', '.', $vlMateriaPrima);
– GustavoSevero