On Tue, Jul 16, 2024 at 5:17 PM Bilge <bi...@scriptfusion.com> wrote:
>
> Hi Internals,
>
> I just ran into a case where I needed the array key in an array_reduce()
> callback, but I can't access it :(
>
> So I wrote a PR to fix it: https://github.com/php/php-src/pull/14986
>
> What do you think? Does this need an RFC?
>
> Cheers,
> Bilge

I don't think it's reasonable to cover every use-case "nicely" in the
standard library. You didn't give a real example. You might consider
using array_walk or iterator_apply, or a foreach loop depending on
what you need.

I am curious what your real use-case is. It may be worth adding
something. It might not. Hard to tell. Adding arguments to a function
can mess up internal callbacks, btw, so I don't like modifying the
existing function.

Reply via email to