Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:67730 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 94819 invoked from network); 18 Jun 2013 22:21:46 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Jun 2013 22:21:46 -0000 Authentication-Results: pb1.pair.com smtp.mail=theanomaly.is@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=theanomaly.is@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.41 as permitted sender) X-PHP-List-Original-Sender: theanomaly.is@gmail.com X-Host-Fingerprint: 74.125.82.41 mail-wg0-f41.google.com Received: from [74.125.82.41] ([74.125.82.41:38600] helo=mail-wg0-f41.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 83/60-27508-87DD0C15 for ; Tue, 18 Jun 2013 18:21:45 -0400 Received: by mail-wg0-f41.google.com with SMTP id y10so58547wgg.2 for ; Tue, 18 Jun 2013 15:21:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=1RvAhD0MgiEERhXmrLnxp0xDZlgQhgy97CK2cpp7G3k=; b=YElFeC5qixDHDnlrR4bQi97tSmn2qahOEjjYCqcDwMjJC1horAl7nEikbfjrJEDYai lWXDsjJATr5b5OFoy5OFMM4sk/eo7sk+yfspF7pOU08QnEMNkJyLCxa0TDuizPqAI4jB 73HqmNSZE87qb+wh5BHODg6BSab05TVtJ3cWK40Ni+SiTXWczKsXBnIa+9YS+s08j+6q Xzbezri+juWqKXPa00U87txGKZvEklfdRwmoPh5JvRtQk5/jVguQGGfkNvsKkQ6ME+MI OlDC/mRi+KLM0VkoMUqKfRt1Fzl8vXxsP8vWDkCaDanO4Icv0w8aZ5ndS+4UPX3gg7cP L/mQ== MIME-Version: 1.0 X-Received: by 10.180.37.133 with SMTP id y5mr8984054wij.20.1371594101594; Tue, 18 Jun 2013 15:21:41 -0700 (PDT) Received: by 10.227.156.201 with HTTP; Tue, 18 Jun 2013 15:21:41 -0700 (PDT) In-Reply-To: References: Date: Tue, 18 Jun 2013 18:21:41 -0400 Message-ID: To: Peter Cowburn Cc: Patrick Schaaf , internals , Tjerk Anne Meesters , Levi Morrison Content-Type: multipart/alternative; boundary=e89a8f50335a33a2ba04df7523ae Subject: Re: [PHP-DEV] PR 287 - added use_keys argument to array_filter() [Discussion] From: theanomaly.is@gmail.com (Sherif Ramadan) --e89a8f50335a33a2ba04df7523ae Content-Type: text/plain; charset=ISO-8859-1 On Tue, Jun 18, 2013 at 6:08 PM, Peter Cowburn wrote: > On 18 June 2013 18:24, Sherif Ramadan wrote: > >> > Nevertheless, I'd say go with a new array_filter_key() function, because >> > that permits using existing one-parameter functions like that strlen as >> a >> > callback, instead of forcing two-parameter callback functions. >> > >> The current patch does not force the callback to take two arguments. By >> default the existing behavior is maintained since the third argument is >> false by default. I still don't hear a good argument for adding a new >> function. > > > I'm very much on the "new function" side of the fence. Basic (one-word) > arguments for this include familiarity and simplicity. > Are you saying that it's better to have familiarity over functionality? I'm not sure I agree with this premise of we shouldn't provide better functionality just because it would make all the other poorly written functions look bad. That's setting a lower bar of standards, isn't it? > Familiarity, since we're used to *_key functions for arrays. It will come > as absolutely no surprise to see the _key function spring up out of nowhere > and its use is blindingly obvious for anyone who has ever used > array_filter(). Simplicity since, err.. what were those flags again? is it > $key first or $value? is there an ARRAY_FILTER_BOTH? Also, I don't pretend > my time with PHP covers everything that everyone has ever done or wanted to > do, but I cannot think of a time when I wanted to filter an array on both > the key *and* the value at the same time: of course, it's easy to make up > use cases. > --e89a8f50335a33a2ba04df7523ae--