Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
重複の可能性: PHP で最も近い 50,000 に切り上げる
私はこれ、52.52 を持っていて、それを 52.5 にしたいのです。PHPでそれを行うにはどうすればよいですか?round() を試しましたが、うまくいきませんでした。ありがとう。
round($num, 1);
$num を最も近い 10 分の 1 に丸める必要があります (2 番目の引数は、精度、または丸めるべき小数点以下の桁数を指定します)
試す
$x = number_format('52.52', 1)
ドキュメントはこちら