Math not working correctly in PHP? -
I am trying to complete the percentage of sales according to the amount originally purchased, here is the code that I I am doing it out with:
$ sold = 212; Bought $ 213; Echo round ($ $ sold $ sold) * 100). "%"; Why is it happening 100% when it is not clearly? It should not be 99.5%
OK, you're rounding Here are the results ...
Try this with:
resonance round (($ $ / $ sold $ $ 100,1). "%";
Comments
Post a Comment