For example, echo number_format(285266237);
can output 285,266,237
In addition, if you need to format the file byte size, the following method 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(2852662 37);
The displayed result is 272M
For example, echo number_format(285266237);
Can output 285,266,237
In addition, if you need to format the file byte size, the following method 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
The above introduces the PHP digital formatting of the mobile phone memory card that cannot be formatted, including the content of the mobile phone memory card that cannot be formatted. I hope it will be helpful to friends who are interested in PHP tutorials.