Need to add comma after every 3 digits using php -


i using cms - megento. want display price value in following format :

add comma after every 3 digits.

for example :

 $price = 987536453 ;  need print 987,536,453. 

try str_split

$price = 987536453;  $price_text = (string)$price; // convert string $arr = str_split($price_text, "3"); // break string in 3 character sets  $price_new_text = implode(",", $arr);  // implode array comma  echo $price_new_text; // output 987,536,453 

Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -