Reputation: 1164
How do I display a small float value like the following in PHP?
0.0048 * 1130000 = 5424
5424 / 100000000 = 5.424E-5
This should be 0.00005424.
Upvotes: 2
Views: 46
Reputation: 5528
If by display you mean convert to string in the format 0.00005424
, you can use sprintf()
like so:
$string = sprintf("%f", 5424 / 100000000)
Upvotes: 0
Reputation: 1164
number_format - doest the trick
$FeeInBTC = number_format( (DB_GetFee() * $fOrderQty)/100000000,9,'.','');
result: 0.000054240
Upvotes: 0