Count - maximiliamus/weby-sloth GitHub Wiki
Counts the number of rows and values of a column.
If '*' specified as the function parameter the number of rows is calculated.
$sloth = Sloth::from($data)
->group('foo', 'baz')
->count(*);$sloth->print();
foo * one 4 two 5
print_r($sloth->fetch());
Array
(
[0] => Array
(
[foo] => one
[*] => 4
)
[1] => Array
(
[foo] => two
[*] => 5
)
)
If nothing is specified as the function parameter the number of non-nullable values is calculated.
$sloth = Sloth::from($data)
->group('foo', 'baz')
->count();$sloth->print();
foo baz one 3 two 4
print_r($sloth->fetch());
Array
(
[0] => Array
(
[foo] => one
[baz] => 3
)
[1] => Array
(
[foo] => two
[baz] => 4
)
)