Re: Re: new function?

From: Date: Tue, 13 Jan 2004 23:19:12 +0000
Subject: Re: Re: new function?
References: 1 2 3 4 5  Groups: php.internals 
Request: Send a blank email to internals+get-7078@lists.php.net to get a copy of this message
Andrey Hristov wrote:
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

« previous php.internals (#7078) next »