Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:67729 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 93229 invoked from network); 18 Jun 2013 22:09:08 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Jun 2013 22:09:08 -0000 Authentication-Results: pb1.pair.com header.from=petercowburn@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=petercowburn@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.51 as permitted sender) X-PHP-List-Original-Sender: petercowburn@gmail.com X-Host-Fingerprint: 74.125.82.51 mail-wg0-f51.google.com Received: from [74.125.82.51] ([74.125.82.51:43167] helo=mail-wg0-f51.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C7/00-27508-38AD0C15 for ; Tue, 18 Jun 2013 18:09:07 -0400 Received: by mail-wg0-f51.google.com with SMTP id e11so3873264wgh.6 for ; Tue, 18 Jun 2013 15:09:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=Awb0R8/MhIVbdoopSisemUCJOmyyJYDMQYjVog+j26s=; b=f7nYOEcZhRpH2nZl9j6b8NgKbk8hESJYdFG9Z7b9LUKeHWngNR1xOY9Fh1SIYywElt UNi0LjM91SGSYJEuLG3lJrsi6Uk6GK5qLCxbc3ZyfE1VqDpwLsReD3NAPAhC5tP1R7py sj2QnX/Ab6JojArek01sYayhv2WPvV9gE4uCDWAoUJ6TF9JhR9PM48IGH0eAndPuX6AF B2/kH3pp/4S55Qj1KZ4IBL3YL5rr29U8xnZuMPGHOQtixGXYcFBietdqiatDJ5aHjIL2 k4TukEIyXT1tiV1bq3s+L1GSZNKHZjHYy/pLx4Ewk19EQNxFjkcLrem8k6Jn97HI3Mep NIlw== X-Received: by 10.194.249.231 with SMTP id yx7mr12239032wjc.13.1371593343934; Tue, 18 Jun 2013 15:09:03 -0700 (PDT) MIME-Version: 1.0 Received: by 10.194.110.101 with HTTP; Tue, 18 Jun 2013 15:08:22 -0700 (PDT) In-Reply-To: References: Date: Tue, 18 Jun 2013 23:08:22 +0100 Message-ID: To: Sherif Ramadan Cc: Patrick Schaaf , internals , Tjerk Anne Meesters , Levi Morrison Content-Type: multipart/alternative; boundary=001a11c29cc40aa83f04df74f6fc Subject: Re: [PHP-DEV] PR 287 - added use_keys argument to array_filter() [Discussion] From: petercowburn@gmail.com (Peter Cowburn) --001a11c29cc40aa83f04df74f6fc Content-Type: text/plain; charset=ISO-8859-1 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. 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. --001a11c29cc40aa83f04df74f6fc--