My version is closer to the original than http://github.com/ramsey/array_column<?php/** * Provides functionality for array_column() to projects using PHP earlier than * version 5.5. * @copyright (c) 2015 WinterSilence (http://github.com/WinterSilence) * @license MIT */if (!function_exists('array_column')) {/** * Returns an array of values representing a single column from the input * array. * @param array $array A multi-dimensional array from which to pull a * column of values. * @param mixed $columnKey The column of values to return. This value may * be the integer key of the column you wish to retrieve, or it may be * the string key name for an associative array. It may also be NULL to * return complete arrays (useful together with index_key to reindex * the array). * @param mixed $indexKey The column to use as the index/keys for the * returned array. This value may be the integer key of the column, or * it may be the string key name. * @return array */function array_column(array $array, $columnKey, $indexKey = null) {$result = array(); foreach ($array as $subArray) { if (!is_array($subArray)) { continue; } elseif (is_null($indexKey) && array_key_exists($columnKey, $subArray)) {$result[] = $subArray[$columnKey]; } elseif (array_key_exists($indexKey, $subArray)) { if (is_null($columnKey)) {$result[$subArray[$indexKey]] = $subArray; } elseif (array_key_exists($columnKey, $subArray)) {$result[$subArray[$indexKey]] = $subArray[$columnKey]; } } } return $result; }}?>

This didn't work for me recursively and needed to come up with a solution.

Here's my solution to the function:

if ( ! function_exists( 'array_column_recursive' ) ) { /** * Returns the values recursively from columns 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. * * @param array $input A multi-dimensional array (record set) from which to pull * a column of values. * @param mixed $columnKey The column of values to return. This value may be the * integer key of the column you wish to retrieve, or it * may be the string key name for an associative array. * @param mixed $indexKey (Optional.) The column to use as the index/keys for * the returned array. This value may be the integer key * of the column, or it may be the string key name. * * @return array */ function array_column_recursive( $input = NULL, $columnKey = NULL, $indexKey = NULL ) {