我试图从一个json url中格式化以下数字。
1835488750000000
到
18,354,887
以下是我的代码
$json_url = $Api;
$json = file_get_contents($json_url);
$data = json_decode($json, true);
$total = $data['value'];
echo number_format(trim($total , 0));
它返回
1.83549E+15
我想从api的网址中格式化totalbc的值。
谢谢你了
你可以把它分成 1E8
并使用 number_format
:
number_format(1835488750000000/1E8);