Hey Folks whats up? I am happy that we developers do great work for the world, and we put wonderful infarct amazing things live for use of others. Well do you know how we seperate thousands with comma in PHP?
PHP number comma separator
We can define our own function for this functionality but why should we define our number really? Cause we already have built in php function which do this for us by just passing a variable in it. number_format() function is a function which help us to put comma in our number in php.
PHP Number Comma example.
[php]
<?php
$your_num = 123154987; //your simple number we will use to put commas in it.
$your_comma_num = number_format($your_num); //number_format function which help us putting comma in numbers.
echo $your_num; //result would be. 123154987
echo $your_comma_num; //result would be 123,154,987
?>
[/php]
That’s it. See how useful functions php have built in.