Uh oh!
There was an error while loading. Please reload this page.
ext/standard: Implement list_filter() - #18291
Conversation
TimWolla
commented
Apr 9, 2025
The correct choice is not to add more functions working on arrays only, but to add a proper iterable API: https://externals.io/message/118896#118896 I believe @iluuu1994 plans to work on it in the nearer future. #18204 is also somewhat related. |
jorgsowa
commented
Apr 9, 2025
I was also waiting for this to be released: #9882 But it's not moving forward, and we are getting new functions into the array API in the last PHP and probably the next one nayways. |
iluuu1994
commented
Apr 9, 2025
Tbf, at least I don't understand what I also think there might be some benefits to offering other |
TimWolla
commented
Apr 10, 2025
Yes, but those are within the existing |
TimWolla
commented
Apr 10, 2025
But generally speaking, the
Ideally the engine would be able to rewrite the code as appropriate, for example by fusing specific known combinations into more efficient functions or loops. |
There are a few array functions that return arrays, without the option to return a list, even when we pass lists to them.
I would like to propose adding such functions to the core. One of them is
list_filter()that is equivalent ofarray_filter(). I will prepare RFC later if the reception is positive.Next functions would be: