Have an account? Sign in
Login  Register  Facebook
how i can make this numbers format in php
assume i have a number 1000 i want php function convert it into 1,000
how i can do that?
Started: September 15, 2011 Latest Activity: September 15, 2011 php numbers
2 Answers
echo number_format(1000);
More info here

Posted: MacOS
In: September 15, 2011

Use number_format()
$strNum = number_format(1000);
There is no requirement to use the 4 parameter overload, as (from the documentation) If only one parameter is given, number will be formatted without decimals, but with a comma (",") between every group of thousands. So
number_format(1000);
is in effect
number_format(1000, 0, '.', ',');

Posted: riatorewall
In: September 15, 2011

Your Answer

xDo you want to answer this question? Please login or create an account to post your answer