我想在PHP中将e-06转换为number,我的代码是:
<?php
$hashrate = 5000000000;
$str = file_get_contents('http://alloscomp.com/bitcoin/calculator/json?hashrate='.$hashrate.'');
$data = json_decode($str, true); // decode the JSON into an associative array
$coinperhour = $data['coins_per_hour'];
echo $coinperhour;
?>运行代码后,它显示了2.2015778741378E-6。如何把它转换成数字?我试过使用echo (int)$coinperhour;,但是代码显示为0,如何修复它?我想要的代码是显示0.00000220157。谢谢
发布于 2015-06-06 08:56:58
$i = 2.2015778741378E-6;
echo $i; // 2.2015778741378E-6
echo number_format ($i,11); // 0.00000220158https://stackoverflow.com/questions/30679888
复制相似问题