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
Post a Comment