On Tue, 2015-10-06 at 15:42 +0400, somebody anon wrote:

Please fix your mail program to provide a name and In-Reply-To and
References headers so that we can address somebody and your mails are
sorted correctly.

> I've implemented this function and two other size-related in php [1], but I
> think they should be in php core to avoid implementation of them by
> thousands of people. This draft is only for demonstation purposes. There
> are presented three functions:
> 
> a. size_format([$format,] $bytes [, $unit]): string

If we do it this must be generic and work for "everybody". This is not
trivial. i.e. for 1001 bytes depending on context any of these might be
"correct":
   * 1001 byte
   * 0.98 KiB
   * 0.98 kB
   * 0,98 kB
   * 1 KiB
   * 1 KB
   * 1 Ko
   * ...
Also one often wants different precision depending on the value
   * 100 MB (not 100.23 MB)
   * 1.44 MB (not 1 MB)

Feel free to come back with a more complete proposal and provide a name,
a proper subject etc.  (... and even then I doubt this has to be part of
the core distribution, we should only add things which can't be done in
userland (due to libraries or performance requirements or similar)  as
userland code is more flexible to change/improve and simpler to debug
for users and especially with PHP 7 fast enough for mot things)

johannes

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to