Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:102588 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 21463 invoked from network); 4 Jul 2018 21:43:27 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Jul 2018 21:43:27 -0000 Authentication-Results: pb1.pair.com header.from=enno.woortmann@web.de; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=enno.woortmann@web.de; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain web.de designates 212.227.17.11 as permitted sender) X-PHP-List-Original-Sender: enno.woortmann@web.de X-Host-Fingerprint: 212.227.17.11 mout.web.de Received: from [212.227.17.11] ([212.227.17.11:57387] helo=mout.web.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F5/88-55607-D7F3D3B5 for ; Wed, 04 Jul 2018 17:43:27 -0400 Received: from [192.168.0.51] ([77.21.86.66]) by smtp.web.de (mrweb102 [213.165.67.124]) with ESMTPSA (Nemesis) id 0LfiqM-1fvFr604i2-00pPgL; Wed, 04 Jul 2018 23:43:22 +0200 To: Levi Morrison Cc: Rowan Collins , internals References: <75db877c-ef0b-7d3b-48a8-9879d90352b0@web.de> <3242366.BL9MUqXe46@vulcan> <2241856.Iz1GuBRvza@vulcan> Message-ID: Date: Wed, 4 Jul 2018 23:43:21 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Antivirus: Avast (VPS 180704-6, 04.07.2018), Outbound message X-Antivirus-Status: Clean X-Provags-ID: V03:K1:AkRw+Gc5d7R7vxg97lRGfn0C1Pi2Hwi/ysvXte3ZX5FuSEXu+jX o+fRnvNJgw+4xtCi/962uaQzJ6Kt/Y68DwVUKqi3YC8ck/GPDiW38rN39qqpizdymeirG0w M4UXpE+f1Y0uotvrCQ22ruNe3FaWYwcaPOuKao5ieczrJMPbt3h8kNX4KQosAvumDxPYOOb z4L7opWjs2q2ef9BiRlUw== X-UI-Out-Filterresults: notjunk:1;V01:K0:S3h60LEZyBw=:sWJ5FghZqAzP8dzFgVg1al 1QrUCoE36QUvNJrOgeXFV7Oe1nNzlix0C33mitl1r/gOuR1tebtxAeL6r9dTz7IDH6cOZhOIP HXgqk3IBwdbWAx9zB6cnwWuwp1pWyDeXmjL8ZtaB2cUhH2BXZptroR7eai7wfDLeC7D6qqGgQ S4s823NEKs3x25FtYsr+WXkWfv5/kkdP1UXc+ZHEDt6AL0jIezKtA1ZcPDR52okMMwgY8k464 kcIdjhtw/7Ere6XXtj0eaRFHWObg1shmlx0EH57F+iu4grsqNyPKzO3h9n+bjXxJb/5EA0kLG joHKT8TRyEi78SKlNUJkn5WSvvSdVFthfuJZ44IbyEu+GJNoVZrmrVOC7WLxAUW4sU1Dr60OU YgZnjybma6ZGmRlNaCfbVl/3B3flVVIh2Yvd9JOs1YC90qpABY0iGg6DenT5ALJdeMD8PptpO zyjxGjUEmyN7QTdjl90zUCcF47Fjj2rMHejO6ILNqxVkUoklNd0Kz4CbKyxE4xxhF+ZGt16RN 7UIrp9g3YNPA6DMjpOuJz46DaOEEKhAfVjdrxjIWGE7QCFAvMxR23tbXvoJ/1K5mOtviBRAfR cQsz3sG7Olu9YunnjXO6oWkVm8eLwaw3dQW72Bb3ZkVf7IlgCxE6r4I9J6kC9DkHdCNaF9JLR 4VvPzXrOnSFWgG6OIsjOIdq6biAe2JzC7LHPqhnR+SR/NTtikZaYzfD9pybhDJtOsk2CvXwnF Iezs+1YiN85OhZ+4k38ke7NpexhPZOmYOW2wgn/pUxnE4bNkXIc6/fq9JiMgOaJsMDMmYYBn6 t2qMTD5 Subject: Re: [PHP-DEV] [RFC][Under Discussion] Add functions array_key_first()and array_key_last() From: enno.woortmann@web.de (Enno Woortmann) Am 28.06.2018 um 16:52 schrieb Levi Morrison: > I think there has been a lack of discussion about why this is desired. > For me, it's always been implementing certain kinds of iterators that > wrap arrays. This means that functions which return both the key and > value are optimal for me. As I already outlined the functions which > return the key-value pair are the most general and do result in clean > code without drawbacks, at least for this use-case. > > Some people do not like this idea. One potential implication this that > maybe their use-case is not the same as mine. What use-cases do other > people have for this? Why are you wanting to grab the first or last > value? What data structure or algorithm is this a bigger part of? Hi Levi, sorry for the long-lasting answer. I use plain arrays relatively often when I develop caching mechanics for = multiple rather complex entities. I query a set of suitable entites and=20 store them as a plain array eg. in Redis. Each request now fetches this preprocessed entities. Sometimes all=20 entities are required but I also have use cases where I filter/sort the=20 list of entries and only one entity is interesting (in all cases I=20 experienced either the first or the last element). This is my initial=20 use case for this RFC. Are there other opinions about the necessity of this functions? Regards, Enno