Previously used to use their own definition of the number format method, the original PHP has always had a number format function, hehe ~
For example, Echo Number_format (285266237);
Can output 285,266,237
In addition, if you need to format file byte size, the following methods can be used for reference:
function Byte_format ($input, $dec =0)
{
$prefix _arr = Array ("B", "K", "M", "G", "T");
$value = Round ($input, $DEC);
$i = 0;
while ($value >1024)
{
$value/= 1024;
$i;
}
$return _str = Round ($value, $dec). $prefix _arr[$i];
return $return _str;
}
echo Byte_format (285266237);
Display result is 272M
http://www.bkjia.com/PHPjc/631931.html www.bkjia.com true http://www.bkjia.com/PHPjc/631931.html techarticle previously used to use their own definition of the number format method, the original PHP has always had a number format function, hehe ~ For example, Echo Number_format (285266237); can output 285,26 ...