Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:85070 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 59665 invoked from network); 16 Mar 2015 15:32:53 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Mar 2015 15:32:53 -0000 Authentication-Results: pb1.pair.com smtp.mail=petercowburn@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=petercowburn@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.177 as permitted sender) X-PHP-List-Original-Sender: petercowburn@gmail.com X-Host-Fingerprint: 209.85.212.177 mail-wi0-f177.google.com Received: from [209.85.212.177] ([209.85.212.177:38668] helo=mail-wi0-f177.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 45/74-34940-0A7F6055 for ; Mon, 16 Mar 2015 10:32:49 -0500 Received: by wifj2 with SMTP id j2so46802940wif.1 for ; Mon, 16 Mar 2015 08:32:45 -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=NRAhqUbWV2+bVOeORALlERLwptY9hGfI3ZtBl+u3Xis=; b=bP+BQdq4pZq0MqwT1FQfj0z6nK1+0X2qj2lMSd1j94XSFiW5uM/tm+DVsDDbDFa2nf pKaAVFrwU5DjsMgR20adOP9PmKXoWnfnPOtcp3B96udvwzcPrK6QI/Z2+rInTL5qFMqn F8jQUzOm/EhDFUKnxTnQVf8lSCZEi03ENJm5oK/IKTaOkwaGSp5p6OXaL+QY8QM1qD9M yScFTlzVxwGMqKWNjgwpiHKXQfEt4ATO2/F8vJ+hQbTCbm5b6EgAE6L5oBsKL6gFX6R/ I56FkHyWvW475Jk55QZ8UqRuwy8/Lqbw49bHEa6+72xfuQ5j2Qe7cLYhdV0xq+9mQsnL HAUg== X-Received: by 10.194.89.195 with SMTP id bq3mr100484618wjb.123.1426519965401; Mon, 16 Mar 2015 08:32:45 -0700 (PDT) MIME-Version: 1.0 Received: by 10.27.175.157 with HTTP; Mon, 16 Mar 2015 08:32:05 -0700 (PDT) In-Reply-To: References: <60525DAED8264509BF14D25637CD7C1E@gmail.com> Date: Mon, 16 Mar 2015 15:32:05 +0000 Message-ID: To: Xinchen Hui Cc: Wei Dai , PHP Internals Content-Type: multipart/alternative; boundary=089e010d833ccd88f20511698f2b Subject: Re: [PHP-DEV] [RFC][DISCUSSION] Add preg_replace_callback_array function From: petercowburn@gmail.com (Peter Cowburn) --089e010d833ccd88f20511698f2b Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 16 March 2015 at 14:59, Xinchen Hui wrote: > Hey: > > On Mon, Mar 16, 2015 at 5:45 PM, Peter Cowburn > wrote: > > On 16 March 2015 at 01:40, Wei Dai wrote: > > > >> Hi internals, > >> > >> The RFC to add a user-land function for an easy-to-use and reliable > >> preg_replace_callback_array() in PHP is up for discussion: > >> https://wiki.php.net/rfc/preg_replace_callback_array > >> > >> This proposes adding one function: `preg_replace_callback_array()` tha= t > >> is the better way to Implement when there are multiple patterns need t= o > >> replace. > >> > >> I would love to hear your feedback! :) > >> > > > > Could you add a paragraph or two explaining the reasons for choosing th= is > > particular proposal? > > Some examples of what I would like to read: > > - why we can't do preg_replace_callback($array_of_regexes, > > $array_of_callbacks, $subject) > array() also could be a valid callback.. (array("clasname", "methodname")= ). > > - why not preg_replace_callback($array_of_regex_to_callback_pairs, > > $subject) > there are also $limit, $count argument could be used. > > - why not pass the regex used to the callback, as per Laruence's earli= er > > RFC > bc break..(change the callback's signature) > > > > And give a few links to historical discussions in the same sort of area= ? > > E.g Laruence's RFC: https://wiki.php.net/rfc/second_arg_to_preg_callbac= k > and > > its discussion thread (http://php.markmail.org/thread/qwiyq5o2vwlbdczq)= . > > > thanks > In case my earlier message wasn't clear, I was asking for the RFC itself to be padded out with those sorts of details. The reason being, many (most) people won't be already familiar with the surrounding discussions that have happened previously, or the reasons for the potentially strange-seeming design choices made in this RFC. > > > > > > > >> Any objections? > >> > >> > >> =E2=80=94 > >> Best, > >> Wei Dai > >> > >> > > > > -- > Xinchen Hui > @Laruence > http://www.laruence.com/ > --089e010d833ccd88f20511698f2b--