Simple maths:
$a=$b/$c; echo $a;
if $b equals to 123.00 and $c equals to 1 then $a becomes 123.
If $b is 123.50, $c is 1, $a is 123.50. But in the former case , I want $a to be 123.00.
It is possible to test whether $a has any non-zero fraction part or not, and then add the trailing zeros as necessary.
But I am looking for php functions to do the same thing. Possible?
EDIT :
What if I do not want the commas from number_format
there ?
Use sprintf("%0.2f",$a);
. docs
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With