简体   繁体   中英

PHP decimal value printing issue

I decoded this json array with json_decode function;

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

Then, I tried to echo "Bid" value, php prints this like;

'9.7E-7'

My PHP Code;

$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;

Output;

'9.7E-7'

I want to print;

0.00000097
echo number_format($finalPrice, 8);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM