PHP十进制值打印问题

时间:2017-10-27 12:10:59

标签: php output decimal

我用json_decode函数解码了这个json数组;

{"success":true,"message":"","result":{"Bid":0.00000097,"Ask":0.00000100,"Last":0.00000100}}

然后,我试图回显“出价”值,php就像打印一样;

'9.7E-7'

我的PHP代码;

$orders = file_get_contents("php://input");
$orders = json_decode($orders, true);
$market = str_replace(" ","",$orders["orders"]["sell"]["market"]);
$price = file_get_contents("https://bittrex.com/api/v1.1/public/getticker?market=".$market);
$price = json_decode($price, true);
$finalprice = (double)$price["result"]["Bid"];
echo $finalprice;

输出;

'9.7E-7'

我想打印;

0.00000097

1 个答案:

答案 0 :(得分:1)

echo number_format($finalPrice, 8);