public static function arrayColumn(array $array, $column_key, $index_key = null)
    {
        $aReturn = array();
        if ($column_key === null) {
            // No column key? Grab the whole row...
            if ($index_key === null) {
                return $array;
            }
            foreach ($array as $sub) {
                $aReturn[$sub[$index_key]] = $sub;
            }
        } elseif (empty($index_key)) {
            foreach ($array as $sub) {
                $aReturn[] = $sub[$column_key];
            }
        } else {
            foreach ($array as $sub) {
                $aReturn[$sub[$index_key]] = $sub[$column_key];
            }
        }
        return $aReturn;
    }
public static function arrayColumn(array $array, $column_key, $index_key = null)
    {
        $aReturn = array();
        if ($column_key === null) {
            // No column key? Grab the whole row...
            if ($index_key === null) {
                return $array;
            }
            foreach ($array as $sub) {
                $aReturn[$sub[$index_key]] = $sub;
            }
        } elseif (empty($index_key)) {
            foreach ($array as $sub) {
                $aReturn[] = $sub[$column_key];
            }
        } else {
            foreach ($array as $sub) {
                $aReturn[$sub[$index_key]] = $sub[$column_key];
            }
        }
        return $aReturn;
    }
public static function arrayColumn ( array $ array , $ column_key , $ index_key = null ) { $ aReturn = array ( ) ; if ( $ column_key === null ) { // No column key? Grab the whole row... if ( $ index_key === null ) { return $ array ; } foreach ( $ array as $ sub ) { $ aReturn [ $ sub [ $ index_key ] ] = $ sub ; } } elseif ( empty ( $ index_key ) ) { foreach ( $ array as $ sub ) { $ aReturn [ ] = $ sub [ $ column_key ] ; } } else { foreach ( $ array as $ sub ) { $ aReturn [ $ sub [ $ index_key ] ] = $ sub [ $ column_key ] ; } } return $ aReturn ; }
Return the values from a single column in the input array

@param array $array A multi-dimensional array (record set) from which to pull a column of values.
@param string|int $column_key The column of values to return.
@param string|int|null $index_key The column to use as the index/keys for the returned array.

@return array
Return the values from a single column in the input array