I have to variables that are like this :
$var1=2.00; $var2=2.00;
Now when i do this to add i lose the decimal
$var3=$var1+$var2;
I get 4 and I want to get 4.00
What am i doing wrong..
In math 4 is equal to 4.00 (if we do not account for significant numbers as used in science). So if you want 4 to be 4.00 it is just a matter of proper formatting.
Try this:
echo number_format($var3, 2);