Re: [RFC] [Discussion] Add new function `array_group`
| From: | mickmackusa | Date: | Wed, 31 May 2023 21:07:13 +0000 |
| Subject: | Re: [RFC] [Discussion] Add new function `array_group` | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-120489@lists.php.net to get a copy of this message | ||
As an answerer and curator of many [php][arrays][grouping] tagged questions
on Stack Overflow for several years, I'd like to mention that developers'
non-SQL grouping needs are much more nuanced than merely defining group
qualification and creating subarrays.
Often devs will want to sum, count (increment a counter), concatenate
another column (or columns), or otherwise mutate the encountered row in
each group.
Have you considered the extendability of your pitched function? Without
these extra considerations, devs would need to make another pass over the
new nested structure.
mickmackusa