Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:88689 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 89311 invoked from network); 5 Oct 2015 22:42:23 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Oct 2015 22:42:23 -0000 Authentication-Results: pb1.pair.com header.from=rowan.collins@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=rowan.collins@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.170 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 209.85.212.170 mail-wi0-f170.google.com Received: from [209.85.212.170] ([209.85.212.170:37973] helo=mail-wi0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id EB/D1-05723-DCCF2165 for ; Mon, 05 Oct 2015 18:42:22 -0400 Received: by wiclk2 with SMTP id lk2so134861656wic.1 for ; Mon, 05 Oct 2015 15:42:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=user-agent:in-reply-to:references:mime-version :content-transfer-encoding:content-type:subject:from:date:to :message-id; bh=zEx0TXwbCREgIm7rhl1maMTs2ZsWdpWKEocKQnZmgoY=; b=KxPkWeMJGkIhHtki1z6Uf+qVoFw2Zt+WMTm2x8AdIaT+ScSDZZJyumT+ol/Dp8zSx0 cbzQgKaNCiLiOTAJjpixH1ix0yfixVO0igDWpScHz6jPaBCDPcHIr5l+WZkvrXXExgot fJIpAOnvq0w2/632cdwj41sNFlfS2uM8kChy4XflJ7HHgzmBLEODeLsyets/d4tQdJZA E/RVOfCn43bHzirgCjeGnjXkRcYfccpPCWybAAJZaW8/aEwpIwjY8i3engEf8ujxhKOA MVDWgQY93HNtsn16eyxIvcCrMOyXEOZvEUowNmbYnng9sX0hSpAv4sre+AIxYSVMzjB+ a+yA== X-Received: by 10.194.90.47 with SMTP id bt15mr36225608wjb.18.1444084938599; Mon, 05 Oct 2015 15:42:18 -0700 (PDT) Received: from [192.168.0.6] (cpc68956-brig15-2-0-cust215.3-3.cable.virginm.net. [82.6.24.216]) by smtp.gmail.com with ESMTPSA id x9sm29140148wjf.44.2015.10.05.15.42.17 for (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 05 Oct 2015 15:42:18 -0700 (PDT) User-Agent: K-9 Mail for Android In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Date: Mon, 05 Oct 2015 23:42:08 +0100 To: internals@lists.php.net Message-ID: <622EE3D6-5AB3-4C54-B29D-AFF650312625@gmail.com> Subject: Re: [PHP-DEV] RFC proposal. From: rowan.collins@gmail.com (Rowan Collins) On 4 October 2015 23:10:25 BST, somebody anon wrote: >Hi PHP community. I am a developer with few years experience in PHP and >now >want to propose some addition to default "filesystem" extension. >There's >money_format and number_format functions to format money and number >values >in human-readable format, but there is not any "size_format" function >that >does the same - reformat an integer that holds size in bytes in >well-formed >string representing size in one of "big" units like MB or GB. So I can >implement function to do this with following interface: >> size_format($format, $bytes, $unit = null) >that will format size like printf with taking in accoun using unit and >multiplier (1k or 1024). >So, I wait for responses. Thanks for attention. An interesting idea. Do you have any idea of the values $format and $unit would accept? Would it handle both decimal-based GB etc and binary-based GiB etc [1]? What about other units that can be scaled in the same way, like metres? Would it make more sense to make it a unit-formatting function or library - and if so, does it need to be in core, or could it just be a lightweight Composer dependency people could grab when they needed it? [1] https://en.m.wikipedia.org/wiki/Binary_prefix Regards, -- Rowan Collins [IMSoP]