Skip to content
Maxim Stupakov edited this page May 29, 2018 · 1 revision

Calculates the total sum of a numeric column.

$sloth = Sloth::from($data)
    ->group('foo', 'baz')
    ->sum();
$sloth->print();
foo     baz
one     6
two     22
print_r($sloth->fetch());
Array
(
    [0] => Array
    (
        [foo] => one
        [baz] => 6
    )
    [1] => Array
    (
        [foo] => two
        [baz] => 22
    )
)
Clone this wiki locally