84669 person learning
152542 person learning
20005 person learning
5487 person learning
7821 person learning
359900 person learning
3350 person learning
180660 person learning
48569 person learning
18603 person learning
40936 person learning
1549 person learning
1183 person learning
32909 person learning
在一个API上获取数据,有个数据小数点比较长,然后你获取的时候就变成了科学计数法,网上找了很久,有没有好一点的方法让他显示原始小数点6.0E-12 转化,谢谢各位了
光阴似箭催人老,日月如移越少年。
嗯,找到解决方法了 function sctonum($num, $double = 5){ if(false !== stripos($num, "e")){ $a = explode("e",strtolower($num)); return bcmul($a[0], bcpow(10, $a[1], $double), $double); } } echo sctonum(2.1E-5, 6); //输出0.000021
如不需要运算获取到后改用字符串,如需运算建议用PHP的BC*高精确度函数
number_format不能满足需求?
如不需要运算获取到后改用字符串,如需运算建议用PHP的BC*高精确度函数
number_format不能满足需求?