>
> 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. :-)

`array_group` is just a simple handy tool which can manipulate a bunch of data
without touching SQL, DQL, query builder, or any producer anymore just to align
the output to the need.

Of course we can code with whatever programming paradigm or style we want,
especially if the algorithm is much more complex. Here, i offer you the very
basic functionality and without external library. So my coworker does not have
to dig into that library, or ask me.

The original proposal is to offer grouping, and may be to avoid `foreach`.
I think if the only purpose is to group an array, it is halfly baked function-
ality. Previously, I had shown you that `foreach` is not too bad to use.
Otherwise, I will suggest to the author don't bother with new function, you're
wasting your time. With that original proposed functionality, We have to use an
additional `foreach` or function call even though it is a basic operation.
Moreover, the original purpose is preserved, if we do not give any optional
params.

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to