私は私のウェブサイトの上にティッカーを持っています。jsonデコードの結果に別の数字を追加するにはどうすればいいですか?
今の結果が表示され2.14
私が呼んでいるAPIは、私に余分な数字を与えますが、その表示されません。
結果はここ2.147
を表示する必要がありますが、私が働いているコードの一部です。
$obj = json_decode($json);
$symbol[$i] = $obj->results[0]->symbol;
$open[$i] = number_format($obj->results[1]->open, 2, '.', ',');
$high[$i] = number_format($obj->results[1]->high, 2, '.', ',');
$low[$i] = number_format($obj->results[1]->low, 2, '.', ',');
$close[$i] = number_format($obj->results[1]->close, 2, '.', ',');
$gap[$i] = number_format($obj->results[1]->close - $obj->results[0]->close, 2, '.', ',');
$percent[$i] = number_format($obj->results[1]->close/$obj->results[0]->close, 2, '.', ',');
10進数の後に3桁目を表示させるにはどうすればよいですか?
' '2 'に' 3 'を変更
は、ここでのドキュメントですか? – frz3993
ドキュメントを読む:http://php.net/manual/en/function.number-format.php – Sammitch