Re: [RFC] [Discussion] Add new function `array_group`
| From: | Larry Garfield | Date: | Tue, 30 May 2023 17:21:42 +0000 |
| Subject: | Re: [RFC] [Discussion] Add new function `array_group` | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-120473@lists.php.net to get a copy of this message | ||
On Tue, May 30, 2023, at 4:27 PM, Boro Sitnikovski wrote:
> Hi,
>
> Thank you for your thoughts.
>
>> I would say the more common desired behavior is the one in your first
>> example. And even for that we don't have a native function.
>
> This Google search might give more insight into the number of
> discussions about a grouping functionality:
>
> https://www.google.com/search?q=php+group+elements+site:stackoverflow.com
>
>> Your behavior can be implemented in userland like so:
>> https://3v4l.org/epvHm
>
> Correct, but then again, we can also implement
>
array_map/array_filter/etc. in
> userland :)
>
>> I think you need to make a case as to why the behavior you describe
>> justifies a native function.
>
> Similar to my previous answer, but also in general - ease of access and
> also performance.
Do you have benchmarks showing that implementing it in C would be notably faster? That would help
the case that it should be written in C.
Also, please do not top-post.
--Larry Garfield