-
- print number_format(100000.56 );
- ?>
复制代码
例2,number_format($n, $p, $t, $d) rounds $n to $p decimal places, using $t as the thousands separator and $d as the decimal separator.
-
- echo "Total charge is ", number_format($total, 2, ".", ","), " Euros";
- ?>
复制代码
例3,number_format函数用于English format and Italian format
-
-
$a = 1232322210.44; - echo number_format ($a, 2); // English format
- echo "n";
- echo number_format ($a, 2, ',', '.'); // Italian format
- echo "n";
- ?>
-
复制代码
例4,输出格式化的数字形式
-
- print "The population of the US is about:";
- print number_format(285266237);
- ?>
复制代码
|