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.
123457たとえば、私は番号を持っています。これ欲しい:1234.57
123457
1234.57
などで試してみましたがformat_number、うまくいきround()ません。
format_number
round()
これどうやってするの?
のような単純な分割から奇妙な結果が得られないようにしたい場合は、それをフォーマットするために$number / 100使用できます。sprintf()
$number / 100
sprintf()
echo sprintf('%.2f', $number / 100);