Re: RFC [Discussion] array_column results grouping
| From: | Hendra Gunawan | Date: | Tue, 07 Dec 2021 03:26:07 +0000 |
| Subject: | Re: RFC [Discussion] array_column results grouping | ||
| References: | 1 2 3 4 5 6 7 8 9 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-116582@lists.php.net to get a copy of this message | ||
>
> Better map/filter/reduce primitives in PHP would be dandy, but they have
> nothing to do with array grouping. They're a separate operation that should
> be composed with grouping. Packing them all into a single function sounds
> like a terrible idea.
>
> If we wanted that... that's called list comprehensions, which I would
> support and even tried to rally support for a few years ago, but got met
> with a big shrug. :-)
We can imagine that
array_group is just a shortcut to:
do grouping, and then do reducing. (common to me)
OR:
do filtering, then do grouping, and the last do reducing. (less common to me)
OR:
do sorting, then do filtering, then do grouping, and the last do reducing.
Best Regards
Hendra Gunawan.