Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:69361 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 70662 invoked from network); 26 Sep 2013 22:51:31 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 Sep 2013 22:51:31 -0000 Authentication-Results: pb1.pair.com smtp.mail=tjerk.meesters@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=tjerk.meesters@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.220.46 as permitted sender) X-PHP-List-Original-Sender: tjerk.meesters@gmail.com X-Host-Fingerprint: 209.85.220.46 mail-pa0-f46.google.com Received: from [209.85.220.46] ([209.85.220.46:37941] helo=mail-pa0-f46.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 5F/66-37010-27AB4425 for ; Thu, 26 Sep 2013 18:51:31 -0400 Received: by mail-pa0-f46.google.com with SMTP id fa1so1946370pad.19 for ; Thu, 26 Sep 2013 15:51:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=references:mime-version:in-reply-to:content-type :content-transfer-encoding:message-id:cc:from:subject:date:to; bh=bf1nlOCdJuJb2nzm5po6gXi6fW6YDF7lff3FC/UwW/s=; b=VJ9TwO71KJ0pvO4FMve09O3OIDqRaGllpY5WmD6iJz3/iUv0ST0QIYBGsUQKgpinkC aXEXxJ7Cj6eU9u21SqAr3xFDhZRqfIPqH7EHHAZfxe9j6taGsZ8IEWePBie5XJ6XSET9 VHz8fRTT2ZbXWNVXtFavwQtEVw0YKr8/iJpUk1OG8uHCHh4XmPaoafMF1zMaiVVQPZAq oSV8XNRcyOY2gtmyVf5driFFNb5adT92lqPCwv5esS1hFj2+6ihOd8duKyu6ydiTbdJ4 x9DXceook8n3mezUcxDebUgElCEvZ6sa2WJr9UOTH6zO3/u8Y/iAwlE+fzGTKlAcG4mU ql4w== X-Received: by 10.68.234.165 with SMTP id uf5mr3791451pbc.41.1380235887961; Thu, 26 Sep 2013 15:51:27 -0700 (PDT) Received: from [192.168.1.105] (bb42-60-19-235.singnet.com.sg. [42.60.19.235]) by mx.google.com with ESMTPSA id ef10sm7828829pac.1.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 26 Sep 2013 15:51:26 -0700 (PDT) References: <13848974-B5E7-4044-9F04-C4EB15E09E9C@gmail.com> <52446146.7060100@ajf.me> Mime-Version: 1.0 (1.0) In-Reply-To: <52446146.7060100@ajf.me> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Message-ID: Cc: "internals@lists.php.net" X-Mailer: iPhone Mail (10B329) Date: Fri, 27 Sep 2013 06:51:25 +0800 To: Andrea Faulds Subject: Re: [PHP-DEV] PR 287 - added use_keys argument to array_filter() [Discussion] From: tjerk.meesters@gmail.com (Tjerk Meesters) Hi, On 27 Sep, 2013, at 12:31 AM, Andrea Faulds wrote: > On 26/09/2013 05:42, Tjerk Meesters wrote: >> Hi, >>=20 >> I've updated my patch to allow a range of values to be passed as the thir= d >> argument: pass key, pass value or pass both. >>=20 >> Instead of using OR-able constants, I went with an enumeration type becau= se >> 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`. >=20 > I suggest the following change: >=20 > ext/standard/php_array.h:119: > > #define ARRAY_FILTER_USE_BOTH 1 > > #define ARRAY_FILTER_USE_KEY 2 > > #define ARRAY_FILTER_USE_VALUE 3 >=20 > becomes: >=20 > ext/standard/php_array.h:119: > > #define ARRAY_FILTER_USE_KEY 1 > > #define ARRAY_FILTER_USE_VALUE 2 > > #define ARRAY_FILTER_USE_BOTH 3 >=20 > Such that we have the best of both worlds, either `ARRAY_FILTER_USE_BOTH` o= r `ARRAY_FILTER_USE_KEY | ARRAY_FILTER_USE_VALUE` :D I deliberately chose these values so that I can simply specify `true` to mea= n pass both values. Bit masks seem cumbersome in this situation.=20 >=20 > --=20 > Andrea Faulds > http://ajf.me/ >=20 > --=20 > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php >=20