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

node.js - StackOverflow API not returning JSON -

ios - Apple Push Notifications + TestFlight + Enterprise wildcard provisioning profile -

android - Drag and drop in ScrollView -