-
Notifications
You must be signed in to change notification settings - Fork 7.8k
ext/standard: Implement list_filter() #18291
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
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. |
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. |
Tbf, at least I don't understand what I also think there might be some benefits to offering other |
Yes, but those are within the existing |
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: