2014-02-06 74 views

回答

5

試試這個str_split

$price = 987536453; 

$price_text = (string)$price; // convert into a string 
$arr = str_split($price_text, "3"); // break string in 3 character sets 

$price_new_text = implode(",", $arr); // implode array with comma 

echo $price_new_text; // will output 987,536,453 
+0

+ 1爲好概念 – 2014-02-06 06:17:47

+0

@ user1862659謝謝兄弟 –

3

您可以通過成千上萬

10

嘗試使用number_format功能。

默認情況下,它打印 '' 每3個數字和削減十進制:

echo(number_format(1234)); 

1,234

相關問題