Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:72362 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 44903 invoked from network); 7 Feb 2014 06:37:19 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Feb 2014 06:37:19 -0000 Authentication-Results: pb1.pair.com header.from=yohgaki@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=yohgaki@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.217.182 as permitted sender) X-PHP-List-Original-Sender: yohgaki@gmail.com X-Host-Fingerprint: 209.85.217.182 mail-lb0-f182.google.com Received: from [209.85.217.182] ([209.85.217.182:48481] helo=mail-lb0-f182.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id AD/11-34013-D1F74F25 for ; Fri, 07 Feb 2014 01:37:18 -0500 Received: by mail-lb0-f182.google.com with SMTP id w7so2359678lbi.27 for ; Thu, 06 Feb 2014 22:37:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=hS7089f+LrVR8+B5Zcn15nn31/181pcjsMwelJWjIBk=; b=aDA2WR2M7WNwlrsA+aicO7ZRto4o7fhcFcmUGq05lNeXQTXetRK+5M0zJP0sT/bSXs XWEXbSxAd+uAdFwTAz1r+Zd2VcIeTF6I33N2Un2UCc33/hiGOHMCeOc5wC3kiyjmHYPX y6Lcm/0LDFzXdzKB/UglkPFHOPuIW6gncJXrwfr6wOxYFAODED1sj2YO9TpW2SDUCrCK TR5TMYeBXbEzOhYiAZ5oXqpazcKYsSQDS6XkYWcjDql2KwylJ0kQwsBc/XxKfLYzo5T+ BYP7kPCFba8rvMgM6tvoyv0JxQJJwRZaDEZ67zXB9yB1rMmQm9ocxTgTkHV3482utJmd itUA== X-Received: by 10.152.120.37 with SMTP id kz5mr5228288lab.30.1391755034774; Thu, 06 Feb 2014 22:37:14 -0800 (PST) MIME-Version: 1.0 Sender: yohgaki@gmail.com Received: by 10.112.199.37 with HTTP; Thu, 6 Feb 2014 22:36:34 -0800 (PST) In-Reply-To: References: Date: Fri, 7 Feb 2014 15:36:34 +0900 X-Google-Sender-Auth: 41-0ohwLxWz_AN8jSQYaUho4zRE Message-ID: To: Tjerk Meesters Cc: Chris Wright , "Kingsquare.nl - Robin Speekenbrink" , PHP Internals Content-Type: multipart/alternative; boundary=089e01228148764fd904f1cb38a5 Subject: Re: [PHP-DEV] [discussion] add array_usearch() From: yohgaki@ohgaki.net (Yasuo Ohgaki) --089e01228148764fd904f1cb38a5 Content-Type: text/plain; charset=UTF-8 Hi all, On Fri, Feb 7, 2014 at 9:26 AM, Tjerk Meesters wrote: > I'm not wildly enthusiastic about another magic flags parameter, but it's > an acceptable compromise for me. The slight advantage there is that > `in_array()` would be bestowed upon the ability to take a callback function > as well. Something like: > > if (in_array('is_numeric', $array, SEARCH_NEEDLE_IS_CALLBACK)) { ... } > What we need is 'closure only callback'. If we have it, then we don't have to worry about string callback functions. if (in_array(function($elem) {return is_numeric(strstr($elem));}, $array)) { ... } Why don't we have 'closure' as signature? It can do more than calling a function. bool in_array(closure $callback, array $ary); Cons would be we cannot search closures in $ary. Is there any use of searching closure? Regards, -- Yasuo Ohgaki yohgaki@ohgaki.net --089e01228148764fd904f1cb38a5--