Formatting bytes with significant figures in PHP 18 Dec
Hopefully these PHP snippets can be useful to someone. The first function formats a number to a specified number of significant figures (this is different from rounding to a number of decimal places). The second function uses the first to display a number of bytes with appropriate human-friendly formatting. e.g. 12345B becomes 123kB (to three significant figures).






