Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:85340 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 41407 invoked from network); 20 Mar 2015 21:44:18 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Mar 2015 21:44:18 -0000 Authentication-Results: pb1.pair.com header.from=jbafford@zort.net; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=jbafford@zort.net; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zort.net designates 96.241.205.2 as permitted sender) X-PHP-List-Original-Sender: jbafford@zort.net X-Host-Fingerprint: 96.241.205.2 nova.zort.net Received: from [96.241.205.2] ([96.241.205.2:40161] helo=nova.zort.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 10/CD-64120-1B49C055 for ; Fri, 20 Mar 2015 16:44:18 -0500 Received: from [10.0.1.2] (pulsar.zort.net [96.241.205.6]) (authenticated bits=0) by nova.zort.net (8.14.5/8.14.5) with ESMTP id t2KLiA58011641 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Fri, 20 Mar 2015 17:44:11 -0400 Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) In-Reply-To: <550C90C7.2020103@gmail.com> Date: Fri, 20 Mar 2015 17:44:10 -0400 Cc: internals@lists.php.net Content-Transfer-Encoding: quoted-printable Message-ID: <4D39BE57-ADE7-43D8-9230-A9BDAB14F345@zort.net> References: <550B5A81.1090706@gmail.com> <550C8879.70002@gmail.com> <550C90C7.2020103@gmail.com> To: Stanislav Malyshev X-Mailer: Apple Mail (2.1878.6) Subject: Re: [PHP-DEV] RFC - Array slice syntactic sugar From: jbafford@zort.net (John Bafford) On Mar 20, 2015, at 17:27, Stanislav Malyshev = wrote: > Hi! >=20 >> I provided an array_key_first() implementation awhile ago that was >> first shot down because =93too many array_* functions=94, and then = later >> ignored because I didn=92t want to go through the RFC process just to >> add a few functions. (PR here: >> https://github.com/php/php-src/pull/347) >=20 > Adding array functions definitely requires and RFC process, arrays are > primary data structure in PHP that stores practically everything, so > having good API for them is essential. It's not that hard to make an > RFC, and given that you propose a change which literally concerns > millions of sites and developers, it's only to be expected that some > formal description and discussion of the proposal is required. Fair enough. Expect to see an RFC once the window for 7.1 opens. >=20 >> If people are generally interested in having an >> array_key_(first|last|index) implementation, I can dust off that PR, >> update it for master, and if we really need an RFC, I=92ll prepare = one >> for PHP 7.1. >=20 > I imagine we do need an RFC for something like that. First element can > be easily accessed with reset and each/current, but the last one is > harder to access without modifying. So maybe it's be a good addition. > There's a lot of time till 7.1 yet so you could definitely make a good = RFC. reset + each/current modifies the array pointer, though, so it=92s = unfortunately not quite that easy. -John