Download the PHP package micheledurante/array-aggregate without Composer
On this page you can find all versions of the php package micheledurante/array-aggregate. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download micheledurante/array-aggregate
More information about micheledurante/array-aggregate
Files in micheledurante/array-aggregate
Package array-aggregate
Short Description A PHP, SQL-like stream aggregate function to group a set of rows by any number of columns. You can also define how to compute groups
License GPL-3.0-or-later
Homepage https://github.com/micheledurante/array-aggregate
Informations about the package array-aggregate
array_aggregate
A PHP, SQL-like stream aggregate function to group a set of rows by any number of columns. You can also define how to compute groups. Rows are expected to be already sorted on the columns used to aggregate results.
The order in which columns are given to the function does not affect the output. Columns must comparable with the ===
operator.
Inspired by Craig Freedman's SQL articles on MS dev blog https://blogs.msdn.microsoft.com/craigfr/2006/09/13/stream-aggregate.
Installation
As a composer package:
Or require the source file in src/array_aggregate.php
.
Usage
Results in:
Similar Projects
array_group_by()
By jakezatecky. Main difference is that
array_aggregate()
won't change the structure of the array by creating new keys/nested groups. It behaves like the SQL
GROUP BY
clause, which returns the aggregates of the input rows. Both functions can work with multiple keys.
array_aggregate()
doesn't allow a callable to match columns.