Hi,
I didn't write this function to be faster. You asked about array_intersect()
and I decided to bechmark (you didn't ask for it though). What I had in mind
when I decided to write it was to escape this :
if (in_array("some_element", $haystack) && in_array("other_element", $haystack) && in_array("third_element", $haystack))
which with this function will be :
in_array_all("first_element","second_element", "third_element", $haystack)
In addtion, I have no problem with the proposal the needles to be passed as an array as first parameter. I did the current proto in the way it's now since it's more consistent with in_array().
Finally, I hope that the list will decide.
Andrey
Christian Schneider wrote:
Hi Andrey,
My personal feeling is that not enough people use this to make the pure speed improvement worth a new function. I guess the list will decide...
- Chris
I like the idea of passing an array of needles, I wonder if you could just add the ability to pass a needles array to in_array, rather than create a new function.
Anyways, it adds flexability, I would use it.
Jason
-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php