【问题标题】:PHP decimal value printing issuePHP十进制值打印问题
【发布时间】:2017-10-27 12:10:59
【问题描述】:

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

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

然后,我尝试回显“Bid”值,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

【问题讨论】:

    标签: php output decimal


    【解决方案1】:
    echo number_format($finalPrice, 8);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-06-22
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多