Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:69356 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 47350 invoked from network); 26 Sep 2013 16:31:41 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 Sep 2013 16:31:41 -0000 Authentication-Results: pb1.pair.com header.from=ajf@ajf.me; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=ajf@ajf.me; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain ajf.me designates 192.64.116.196 as permitted sender) X-PHP-List-Original-Sender: ajf@ajf.me X-Host-Fingerprint: 192.64.116.196 imap4.ox.registrar-servers.com Received: from [192.64.116.196] ([192.64.116.196:60022] helo=imap4.ox.registrar-servers.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 66/F1-37010-B6164425 for ; Thu, 26 Sep 2013 12:31:40 -0400 Received: from localhost (localhost [127.0.0.1]) by oxmail.registrar-servers.com (Postfix) with ESMTP id BA12E56007C for ; Thu, 26 Sep 2013 12:31:36 -0400 (EDT) X-Virus-Scanned: Debian amavisd-new at imap4.ox.registrar-servers.com Received: from oxmail.registrar-servers.com ([127.0.0.1]) by localhost (imap4.ox.registrar-servers.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id ossizCuIHNVk for ; Thu, 26 Sep 2013 12:31:36 -0400 (EDT) Received: from [192.168.0.200] (unknown [94.10.74.149]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by oxmail.registrar-servers.com (Postfix) with ESMTPSA id 5DC8B56006A for ; Thu, 26 Sep 2013 12:31:36 -0400 (EDT) Message-ID: <52446146.7060100@ajf.me> Date: Thu, 26 Sep 2013 17:31:02 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.0 MIME-Version: 1.0 To: internals@lists.php.net References: <13848974-B5E7-4044-9F04-C4EB15E09E9C@gmail.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] PR 287 - added use_keys argument to array_filter() [Discussion] From: ajf@ajf.me (Andrea Faulds) On 26/09/2013 05:42, Tjerk Meesters wrote: > Hi, > > I've updated my patch to allow a range of values to be passed as the third > argument: pass key, pass value or pass both. > > Instead of using OR-able constants, I went with an enumeration type because > there are only going to be three options; it just felt wrong to have > `ARRAY_FILTER_USE_KEY | ARRAY_FILTER_USE_VALUE` instead of a simpler > `ARRAY_FILTER_USE_BOTH` or even just `true`. I suggest the following change: ext/standard/php_array.h:119: > #define ARRAY_FILTER_USE_BOTH 1 > #define ARRAY_FILTER_USE_KEY 2 > #define ARRAY_FILTER_USE_VALUE 3 becomes: ext/standard/php_array.h:119: > #define ARRAY_FILTER_USE_KEY 1 > #define ARRAY_FILTER_USE_VALUE 2 > #define ARRAY_FILTER_USE_BOTH 3 Such that we have the best of both worlds, either `ARRAY_FILTER_USE_BOTH` or `ARRAY_FILTER_USE_KEY | ARRAY_FILTER_USE_VALUE` :D -- Andrea Faulds http://ajf.me/