number_format() 函數(shù)用于格式化千位分組的數(shù)字。
number_format(num,decimals,decimal_pt,separator)
num - 要格式化的數(shù)字。
decimals - 指定小數(shù)位數(shù)。
decimal_pt - 用于小數(shù)點(diǎn)的字符串。
分隔符 - 指定用于千位分隔符的字符串。
number_format() 函數(shù)返回格式化的數(shù)字。
立即學(xué)習(xí)“PHP免費(fèi)學(xué)習(xí)筆記(深入)”;
以下是一個(gè)示例 -
?實(shí)時(shí)演示
<?php echo number_format("10000000"); ?>
以下是輸出 -
10,000,000
讓我們看另一個(gè)示例 -
?現(xiàn)場(chǎng)演示
<?php echo number_format("3999.9, 2"); ?>
以下是輸出 -
4,000
以上就是PHP中的number_format()函數(shù)的詳細(xì)內(nèi)容,更多請(qǐng)關(guān)注php中文網(wǎng)其它相關(guān)文章!
PHP怎么學(xué)習(xí)?PHP怎么入門?PHP在哪學(xué)?PHP怎么學(xué)才快?不用擔(dān)心,這里為大家提供了PHP速學(xué)教程(入門到精通),有需要的小伙伴保存下載就能學(xué)習(xí)啦!
微信掃碼
關(guān)注PHP中文網(wǎng)服務(wù)號(hào)
QQ掃碼
加入技術(shù)交流群
Copyright 2014-2025 http://m.miracleart.cn/ All Rights Reserved | php.cn | 湘ICP備2023035733號(hào)