PHP numeric formatting. For example, echonumber_format (285266237); 285,266,237 can be output. if you need to format the file's byte size, the following method can be used for reference: functionbyte_format ($ input, $ dec0) {$ p, for example, echo number_format (285266237 );
Output 285,266,237
In addition, if you need to format the file size in bytes, 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;
}
Response byte_format (285266237 );
The result is 272 MB.
For example, echo number_format (285266237 );
Output 285,266,237
In addition, if you need to format the file size in bytes, 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
Bytes (285266237); you can output 285,266,237. if you need to format the file's byte size, the following method can be used for reference: functionbyte_format ($ input, $ dec = 0) {$ p...