> -----Original Message-----
> From: Morgan L. Owens [mailto:[email protected]]
> Sent: 25 June 2012 15:41
>
> On 2012-06-25 04:19, Ralph Schindler wrote:
> >> The term 'column' makes a lot of sense for PDO working with
> database
> >> columns, but there is no concept of a 'column' in the array
> structure or
> >> PHP as a whole, outside of database related functions.
> >
> > In the case of this addition, I do indeed like array_pluck as
> well, as
> > column feel like an overloaded term.
> >
> While casting around for other array_* names, I remembered that
> array_keys() can take a second (and third) argument. With it, the
> function returns all keys indexing a given value.
>
> What we're discussing here is basically a dual to that: return all
> values indexed by a given key.[*]
>
> If the duality is continued, then what we get is
>
> array_values(array $input[, mixed $key])
I see what you're getting at, but in my opinion the WTF factor is
too high on this one -- the change from inspecting the outermost
elements to those a level down is too much to load on to a single
extra parameter in my opinion.
However, I do wonder if a related name may not be the way to go,
since it is similar in that both are extracting values from the
array -- perhaps:
array_inner_values($array, $key);
or
array_subvalues($array, $key);
Also, I wonder if there might be scope for multiple $key parameters,
to extract values from defined positions at even lower levels, so
that, for example:
array_whatever($array, 'colour', 'orange');
would return all sub-elements addressed as $array['colour']['orange'];
(Also, also: how would you see this proposal in relation to the
one for array_part(), should some version of that gain approval?)
Cheers!
Mike
--
Mike Ford,
Electronic Information Developer, Libraries and Learning Innovation,
Portland PD507, City Campus, Leeds Metropolitan University,
Portland Way, LEEDS, LS1 3HE, United Kingdom
E: [email protected] T: +44 113 812 4730
To view the terms under which this email is distributed, please go to
http://disclaimer.leedsmet.ac.uk/email.htm