News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Ben Ramsey:
Introducing Array_column() in PHP 5.5
March 21, 2013 @ 10:46:01

Ben Ramsey has a new post talking about a feature that will become available in the PHP 5.5.x release series of the language - the array_column function. This function will extract all values from an array matching a given key.

My original patch for array_column() was written for PHP 5.2, but it sat around collecting dust for many years, until April of last year, when PHP moved to git and GitHub. That's when it became easy enough to apply the patch and send a pull request, which I did. [...] My goal for array_column() was simplicity. Many implement the functionality in different ways, and many call the function by other names (such as "pluck"), but I wanted to keep it simple and recognizable.

He includes an example of some sample data and how the function could be used to pull out the "last_name" field from each of the records and return just those as an array. If you're interested in seeing the original proposal and the RFC that was created for it, you can see it on the PHP wiki.

0 comments voice your opinion now!
arraycolumn array function index feature language


blog comments powered by Disqus

Similar Posts

Setfive.com: PHP: Some thoughts on using array_* with closures

MegaLeecher.net: Decoding CAPTCHA using PHP | Hypertext Preprocessor

PHP.net: PHP 5.6.8, 5.5.24 & 5.4.40 Released (Security Fixes)

Erika Heidi Reinaldo: Advices and resources for PHP novices

Inside Open Source: Possible addition to array syntax in PHP


Community Events

Don't see your event here?
Let us know!


series example application interview release library introduction configure opinion php7 performance symfony2 podcast community conference laravel install api language framework

All content copyright, 2015 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework