Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:64899 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 73024 invoked from network); 12 Jan 2013 17:38:33 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 Jan 2013 17:38:33 -0000 X-Host-Fingerprint: 68.52.111.150 c-68-52-111-150.hsd1.tn.comcast.net Received: from [68.52.111.150] ([68.52.111.150:17220] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id FD/49-24230-89F91F05 for ; Sat, 12 Jan 2013 12:38:33 -0500 To: internals@lists.php.net Message-ID: <50F19F95.6080005@php.net> Date: Sat, 12 Jan 2013 11:38:29 -0600 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:13.0) Gecko/20120614 Thunderbird/13.0.1 MIME-Version: 1.0 CC: Peter Cowburn References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Posted-By: 68.52.111.150 Subject: Re: [PHP-DEV] [VOTE] array_column() function From: ramsey@php.net (Ben Ramsey) On 1/12/13 10:13 AM, Peter Cowburn wrote: > 1. Why is this branch based on 5.3, rather than 5.4 or 5.5? Do you > want this to be part of 5.3? The RFC (in particular the vote question) > does not make it clear where/when you want this to be added. I mentioned this in another response on this thread. I was just following instructions from the wiki, but I can issue another pull request against master or some other branch. This is intended for 5.5. > 2. The $columnKey argument "may be the 0-indexed number of the column > you wish to retrieve, or it may be the string key name for an > associative array." > > When the nested arrays use numeric indices and the function is called > with a number, then this argument is not "the 0-indexed number of the > column" but rather the integer key (i.e., the $columnKey is always > specifying the key, regardless of integer or string). Could the > description be updated to reflect that, if it is indeed the desired I've updated the RFC on the wiki to include your suggestions. > behaviour? Also, when the nested arrays are non-0-indexed should we > be able to somehow specify the column (rather than the key)? I have no > answer of my own for that last question! I'm not quite sure what you're asking here. Do you mean specifying something like the numeric column position, rather than the string key? > > 3. It is not documented what happens when the $columnKey and/or > $indexKey are not present in the nested array, could this be added? > The current implementation appears to not include an item in the > resulting array if $columnKey is not present. If $columnKey is present > but $indexKey is not, a 0-based index is used in the current > implementation. I've added Example #4 to illustrate this. > 4. An example of what happens when the resulting array has overlapping > keys would not go amiss (though the behaviour is obvious). I've added Example #5 for this. > 5. Regarding the alias, so long as we clearly mention the word "pluck" > (or "array_pluck") on the documentation page, folks coming from other > languages should be able to find our implementation. I'm not sure we > really need it as an actual alias, but have no strong opinion one way > or the other. My opinion on this isn't strong, either. I've already given my rationale in another post to this thread, but if most people want the alias removed, I'm okay with that. > Overall, I'm liking this simple addition to the array library. >