PeeS
PeeS

Reputation: 1164

Displaying a small float shows up as 5.424E-5 in PHP

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

Answers (3)

thumber nirmal
thumber nirmal

Reputation: 1617

Try this:

echo echo number_format(5424 / 100000000,10);

Upvotes: 1

Pavlin
Pavlin

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

PeeS
PeeS

Reputation: 1164

number_format - doest the trick

$FeeInBTC = number_format( (DB_GetFee() * $fOrderQty)/100000000,9,'.','');

result: 0.000054240

Upvotes: 0

Related Questions