Another day and another function. This time a function, which converts size in bytes to a human readable format. For example, 1024 will become "1KB", but 1048576 will become "1MB".
You can also specify the precision that you want the number to formated with. For example, if $bytes variable was originally 1,000,000 bytes then the result would be "976.56 KB" if the precision set to 2 or "976 KB" if set to 0.
Here is a small function that converts number of seconds to an array containing hours, minutes and seconds separately.