public static function columnSum(array $data, array $columns)
    {
        $result = array();

        foreach ($columns as $column) {
            foreach ($data as $collection) {
                if (isset($collection[$column])) {
                    if (isset($result[$column])) {
                        $result[$column] += $collection[$column];
                    } else {
                        $result[$column] = $collection[$column];
                    }
                }
            }
        }

        return $result;
    }
public static function columnSum(array $data, array $columns)
    {
        $result = array();

        foreach ($columns as $column) {
            foreach ($data as $collection) {
                if (isset($collection[$column])) {
                    if (isset($result[$column])) {
                        $result[$column] += $collection[$column];
                    } else {
                        $result[$column] = $collection[$column];
                    }
                }
            }
        }

        return $result;
    }
public static function columnSum ( array $ data , array $ columns ) { $ result = array ( ) ; foreach ( $ columns as $ column ) { foreach ( $ data as $ collection ) { if ( isset ( $ collection [ $ column ] ) ) { if ( isset ( $ result [ $ column ] ) ) { $ result [ $ column ] += $ collection [ $ column ] ; } else { $ result [ $ column ] = $ collection [ $ column ] ; } } } } return $ result ; }
Counts column sum

@param array $data
@param array $columns
@return array
Counts column sum