On 12 January 2013 00:17, Ben Ramsey <ram...@php.net> wrote:
> I've opened voting for the array_column() function RFC.
>
> You can vote at https://wiki.php.net/rfc/array_column#voting
>

I like the idea of this function, but have a few minor questions re.
the current implementation.

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.

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
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!

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.

4. An example of what happens when the resulting array has overlapping
keys would not go amiss (though the behaviour is obvious).

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.

Overall, I'm liking this simple addition to the array library.

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to