Re: [DRAFT] RFC - array_column() function

From: Date: Fri, 22 Jun 2012 21:20:52 +0000
Subject: Re: [DRAFT] RFC - array_column() function
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-60943@lists.php.net to get a copy of this message
Hey Ben, On 22 Jun 2012, at 08:52, Ben Ramsey wrote: > On 6/22/12 5:32 AM, Léo Peltier wrote: >> Hi, >> >> Shouldn't this be called 'array_pluck'? >> This is the name people usually use when implementing it in PHP (see >> "array_pluck(" vs "array_column(" in Google) or in other languages/libs >> (see underscorejs, prototypejs and RoR). >> > > I'm open to changing or aliasing the name to array_pluck(), if others are in agreement. We have a version of this at Facebook and its called array_pull() it has a third parameter and supports pulling a new key value too. You can find a copy of it in Phabricator. There is also mpull() which is for methods. I'd recommend combining the two methods to be honest and doing a single function that supports index names or a method. https://github.com/facebook/libphutil/blob/master/src/utils/utils.php#L143 - S

« previous php.internals (#60943) next »