php格式化数字的小例子 number_format函数的用法举例
例1,格式化数字为文本
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
<?php
$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);
?>
您可能感兴趣的文章:
php格式化数字的小例子 number_format函数的用法举例
PHP 数字格式化函数number_format的用法
php number_format()保留小数点后几位
php 数字格式化函数 number_format 简介
php数字格式化的例子(number_format函数应用)
php number_format函数怎么用?
PHP小数点后保留几位的简单示例
php 格式化数字 位数不足前面加0补足的实现方法
php保留两位小数的方法
学习php的number_format() 函数定义和用法