# The array_column() PHP Userland Library


By Ben Ramsey

Published on July 6, 2013

Updated on April 6, 2015

Earlier this year, I [wrote about][array_column-article] how [my patch][patch] for [`array_column()`][array_column] was merged into the development branch for PHP 5.5 in preparation for the beta release. I received a lot of great feedback and many kind words. Then, on June 20, the [PHP team announced the general availability version of 5.5.0][php55ga]. With that, `array_column()` was released to the world for general use.

Many still use earlier versions of PHP, though. While the functionality of `array_column()` is simple enough to implement on your own in userland code, I've released a small library that implements it in userland code exactly as it's implemented in the core, complete with the same PHP error messages and warnings. The library is also upgrade-proof, so when you start running your projects on PHP 5.5+, you'll immediately take advantage of the built-in, core `array_column()` function, rather than the library—without the need to modify your code.

The library has no dependencies and has been tested on PHP 5.3 and 5.4. The library's unit tests also pass with the core version of `array_column()` in PHP 5.5. Additionally, the library passes the [phpt][] core tests for the function.

To use the library in your projects, simply download the [source code][array_column-github] and include `src/array_column.php` where you need to use it. Alternately (and recommended), the library supports installation via [Composer][]. You may add it to your project requirements by running this command:

```shell
$ php composer.phar require ramsey/array_column
```

Check out the [project on Github][array_column-github], and I hope you enjoy using `array_column()`.


[array_column-article]: /blog/2013/03/introducing-array-column-in-php-5-dot-5/
[patch]: https://github.com/php/php-src/pull/257
[array_column]: https://www.php.net/array_column
[php55ga]: https://www.php.net/archive/2013.php#id2013-06-20-1
[phpt]: https://php.github.io/php-src/miscellaneous/writing-tests.html
[array_column-github]: https://github.com/ramsey/array_column
[composer]: https://getcomposer.org/


