public function column(array $src, $column, $skip = false, $skipEmpty = false)
    {
        $result = array();

        // process each row
        foreach ($src as $key => $row) {
            // if current row is an array and the specified column exists
            // store column value otherwise null
            if (is_array($row) && array_key_exists($column, $row)) {
                if (!$skipEmpty || !empty($row[$column])) {
                    $result[$key] = $row[$column];
                }
            } else {
                // skip not existing values ...
                if (!$skip) {
                    // ... or add null
                    $result[$key] = null;
                }
            }
        }

        return $result;
    }
public function column(array $src, $column, $skip = false, $skipEmpty = false)
    {
        $result = array();

        // process each row
        foreach ($src as $key => $row) {
            // if current row is an array and the specified column exists
            // store column value otherwise null
            if (is_array($row) && array_key_exists($column, $row)) {
                if (!$skipEmpty || !empty($row[$column])) {
                    $result[$key] = $row[$column];
                }
            } else {
                // skip not existing values ...
                if (!$skip) {
                    // ... or add null
                    $result[$key] = null;
                }
            }
        }

        return $result;
    }
public function column ( array $ src , $ column , $ skip = false , $ skipEmpty = false ) { $ result = array ( ) ; // process each row foreach ( $ src as $ key => $ row ) { // if current row is an array and the specified column exists // store column value otherwise null if ( is_array ( $ row ) && array_key_exists ( $ column , $ row ) ) { if ( ! $ skipEmpty || ! empty ( $ row [ $ column ] ) ) { $ result [ $ key ] = $ row [ $ column ] ; } } else { // skip not existing values ... if ( ! $ skip ) { // ... or add null $ result [ $ key ] = null ; } } } return $ result ; }
Extract one column of an 2-dim array.

@param array $src       2-dim array
@param mixed $column    name or index of column to extract
@param bool  $skip      (Optional) skip not existing values, default: add null
@param bool  $skipEmpty (Optional) skip not empty values, default: add null

@return array
Extract one column of an 2 - dim array .