November 13th, 2000, 11:22 PM
-
how to format output of database into money format,ex: tou got form for entering number,then you want to fetch the result into money format like;
entry;20000000
output:$20,000,000 etc
the problem is entry using integer so every format function will fail.
thanks in advance
------------------
great hope of palembang ,indonesia
November 14th, 2000, 04:19 AM
-
Read the manual.
echo "$" . number_format($integer);
---John Holmes...
number_format
(PHP 3, PHP 4 )
number_format -- Format a number with grouped thousands
Description
string number_format (float number, int decimals, string dec_point, string thousands_sep)
Number_format() returns a formatted version of number. This function accepts either one, two or four parameters (not three):
If only one parameter is given, Number will be formatted without decimals, but with a comma (",") between every group of thousands.
If two parameters are given, number will be formatted with decimals decimals with a dot (".") in front, and a comma (",") between every
group of thousands.
If all four parameters are given, number will be formatted with decimals decimals, dec_point instead of a dot (".") before the decimals
and thousands_sep instead of a comma (",") between every group of thousands.