Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:7078 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 30308 invoked by uid 1010); 13 Jan 2004 23:19:15 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 30263 invoked from network); 13 Jan 2004 23:19:15 -0000 Received: from unknown (HELO h24-68-209-231.gv.shawcable.net) (24.68.209.231) by pb1.pair.com with SMTP; 13 Jan 2004 23:19:15 -0000 Received: from zworg.com (localhost.localdomain [127.0.0.1]) by h24-68-209-231.gv.shawcable.net (8.12.8/8.12.8) with ESMTP id i0DNJDKm008103 for ; Tue, 13 Jan 2004 15:19:13 -0800 Message-ID: <40047CF0.8070306@zworg.com> Date: Tue, 13 Jan 2004 15:19:12 -0800 User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5) Gecko/20031007 X-Accept-Language: en-us, en MIME-Version: 1.0 To: internals@lists.php.net References: <40045BB4.4050000@hristov.com> <40046198.6010800@cschneid.com> <400466AB.2020502@hristov.com> <40047235.8020902@cschneid.com> <4004785F.4050208@hristov.com> In-Reply-To: <4004785F.4050208@hristov.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Re: new function? From: jdavidson@zworg.com (jason davidson) 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