I have a number that is a string with a value of “53 MILLION”.
$number="53 MILLION";
I want this number to be 53,000,000. How would go about doing this? I tried using the number_format function but with no luck.
Thanks in advance!
$number="53 MILLION";
$number= str_replace($number, "MILLION", "000,000");
echo $number; //000,000 instead of 53,000,000
Building on what Jesus said, a simple function to construct these numbers would be:
This would also be able to convert 8 hundred thousand = 800,000 etc.