PHPackages                             ramsey/array\_column - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. ramsey/array\_column

Abandoned → [it-for-free/array\_column](/?search=it-for-free%2Farray_column)ArchivedLibrary[Utility &amp; Helpers](/categories/utility)

ramsey/array\_column
====================

Provides functionality for array\_column() to projects using PHP earlier than version 5.5.

1.1.3(11y ago)3703.6M↓11.2%78[3 issues](https://github.com/ramsey/array_column/issues)20MITPHP

Since Mar 23Pushed 7y ago15 watchersCompare

[ Source](https://github.com/ramsey/array_column)[ Packagist](https://packagist.org/packages/ramsey/array_column)[ Docs](https://github.com/ramsey/array_column)[ RSS](/packages/ramsey-array-column/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)Dependencies (4)Versions (6)Used By (20)

array\_column() for PHP
=======================

[](#array_column-for-php)

[![Build Status](https://camo.githubusercontent.com/aeac52ee15facb991b34ce91fa7730333b1a21cb98a1f020fd032a34db6730d0/68747470733a2f2f7472617669732d63692e6f72672f72616d7365792f61727261795f636f6c756d6e2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/ramsey/array_column)[![Coverage Status](https://camo.githubusercontent.com/52aaa3ee29baa09ed856f8be869ca0ee42345b1dd9f9b8805294b904807d2354/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f72616d7365792f61727261795f636f6c756d6e2f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/r/ramsey/array_column)[![Latest Stable Version](https://camo.githubusercontent.com/25ab92471382d2362a67f025185f56b75296f7120c905688224802605be03ccf/68747470733a2f2f706f7365722e707567782e6f72672f72616d7365792f61727261795f636f6c756d6e2f762f737461626c652e737667)](https://packagist.org/packages/ramsey/array_column)[![Total Downloads](https://camo.githubusercontent.com/11dd2fc4dda13f3f99831ef5f2b5a4e16a0afd407c1ee7a46eea111820570b87/68747470733a2f2f706f7365722e707567782e6f72672f72616d7365792f61727261795f636f6c756d6e2f646f776e6c6f6164732e737667)](https://packagist.org/packages/ramsey/array_column)[![Latest Unstable Version](https://camo.githubusercontent.com/83a89a820bbacbe9d827773210967dfe136ba3b5879f2ca3e7f86dc17d8040ac/68747470733a2f2f706f7365722e707567782e6f72672f72616d7365792f61727261795f636f6c756d6e2f762f756e737461626c652e737667)](https://packagist.org/packages/ramsey/array_column)[![License](https://camo.githubusercontent.com/e0271d18d3245ec4e7fc918fc1257ed0aa536ac487684bf6dbb8548125cff84a/68747470733a2f2f706f7365722e707567782e6f72672f72616d7365792f61727261795f636f6c756d6e2f6c6963656e73652e737667)](https://packagist.org/packages/ramsey/array_column)

This simple library provides functionality for [`array_column()`](http://php.net/array_column)to versions of PHP earlier than 5.5. It mimics the functionality of the built-in function in every way.

Usage
-----

[](#usage)

```
array array_column(array $input, mixed $columnKey[, mixed $indexKey])

```

Given a multi-dimensional array of data, `array_column()` returns the values from a single column of the input array, identified by the `$columnKey`. Optionally, you may provide an `$indexKey` to index the values in the returned array by the values from the `$indexKey` column in the input array.

For example, using the following array of data, we tell `array_column()` to return an array of just the last names, indexed by their record IDs.

```
