parsebytesize
Quote
parsebytesize ( int $size [, int $digits [, bol $dir ] ] )
Parameters
size
The size you want to parse
digits
It's a bit wrong name, this is the number of decimal digits at the end
dir
Set this to true if you want the function to return empty if the size is 0, default is true
Return Values
This function will return the easiest way to display the size of bytes
Examples
Example 1
Code
<?php
echo parsebytesize(100);
echo parsebytesize(10000, 3);
echo parsebytesize(1000000, 4);
echo parsebytesize(100000000);
?>
Here we will parse different sizes of bytes to get the best and simplest way to display them
Output to Example 1
Quote
100Bytes
9.766Kb
976.562Kb
95.37Mb
Example 2
Code
<?php
parsebytesize(0);
parsebytesize(0, 2, true);
?>
Here we will try out to have the parsebytesize() function with an empty size. You see if we set the $dir variable to true, the function will return empty in stead of 0 bytes
Output to Example 2
Changelog
7.01.02 - Output text is now using locales.
7.01.00 - Fixed bits to bytes for correct ISO standards.