Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:85071 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 62380 invoked from network); 16 Mar 2015 15:47:41 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Mar 2015 15:47:41 -0000 Authentication-Results: pb1.pair.com header.from=laruence@php.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=xinchen.h@zend.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 209.85.215.41 as permitted sender) X-PHP-List-Original-Sender: xinchen.h@zend.com X-Host-Fingerprint: 209.85.215.41 mail-la0-f41.google.com Received: from [209.85.215.41] ([209.85.215.41:33655] helo=mail-la0-f41.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C3/D4-34940-91BF6055 for ; Mon, 16 Mar 2015 10:47:39 -0500 Received: by ladw1 with SMTP id w1so43609597lad.0 for ; Mon, 16 Mar 2015 08:47:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type:content-transfer-encoding; bh=O1eOyH5jb6825mHKXbIKxgah+oKjLTrSe9D/1kInUYw=; b=mZNYDQLbq9lHBN5eK6q2KV+y0l/90vD4KUt22SY9iyr3X+AQBMz5u2X9HCJ6Vjt0wI eIFV3IQ+FPbe3RQSsJkyIQTW+HQd/h2AsoxCabK/L6fQS1LpOfpFi1JDkaqsUzSOQ7mi WgRYsqNl/wnNe8pVL3Wi3pu1zKFopdoxDVm4I2LiTGDeezmDrdfgASdzkmetwnDCSnuY 9nKcC1jfnhWZwrV9mygVUYKKGBcy49iKp1W5sT3BiYCDa2ZsNoQwORiB96d16UxVRBvy NEJZsm4l1c1LN27dJ2LplAy06jMV4j+LRpH+NcNG/Gjy9jMSQgzIuC1aSgqF29lOHsGS LKgQ== X-Gm-Message-State: ALoCoQkX9hEb3U5CykrZDC08tsWjLuklGmIDGp2EJaJF7B1Xxinsb1Hl1R5WhCS74HTi4WLp4N04GbrBgfVUEeU4dfeaNMyY1Mt7vgchF7AVqNIHGz9pQEGgey6AWyhmHwjnfYtWe8w8ebyWOcuJCMq4mncfANomTw== X-Received: by 10.152.22.1 with SMTP id z1mr44274781lae.114.1426520854248; Mon, 16 Mar 2015 08:47:34 -0700 (PDT) Received: from mail-la0-f52.google.com (mail-la0-f52.google.com. [209.85.215.52]) by mx.google.com with ESMTPSA id h7sm2260814laf.19.2015.03.16.08.47.32 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 Mar 2015 08:47:33 -0700 (PDT) Received: by ladw1 with SMTP id w1so43608697lad.0 for ; Mon, 16 Mar 2015 08:47:32 -0700 (PDT) X-Received: by 10.152.179.139 with SMTP id dg11mr50130572lac.28.1426520852369; Mon, 16 Mar 2015 08:47:32 -0700 (PDT) MIME-Version: 1.0 Received: by 10.114.82.99 with HTTP; Mon, 16 Mar 2015 08:47:12 -0700 (PDT) In-Reply-To: References: <60525DAED8264509BF14D25637CD7C1E@gmail.com> Date: Mon, 16 Mar 2015 23:47:12 +0800 Message-ID: To: Peter Cowburn Cc: Wei Dai , PHP Internals Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] [RFC][DISCUSSION] Add preg_replace_callback_array function From: laruence@php.net (Xinchen Hui) Hey: On Mon, Mar 16, 2015 at 11:32 PM, Peter Cowburn wr= ote: > 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()` th= at >> >> is the better way to Implement when there are multiple patterns need = to >> >> replace. >> >> >> >> I would love to hear your feedback! :) >> >> >> > >> > Could you add a paragraph or two explaining the reasons for choosing t= his >> > 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 earl= ier >> > RFC >> bc break..(change the callback's signature) >> > >> > And give a few links to historical discussions in the same sort of are= a? >> > E.g Laruence's RFC: https://wiki.php.net/rfc/second_arg_to_preg_callba= ck >> 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 ha= ve > happened previously, or the reasons for the potentially strange-seeming > design choices made in this RFC. hmm, yeah, it's better to have these in the RFC. I just replied in case Wei Dai is not familar with these reasons thanks > > >> > >> > >> > >> >> Any objections? >> >> >> >> >> >> =E2=80=94 >> >> Best, >> >> Wei Dai >> >> >> >> >> >> >> >> -- >> Xinchen Hui >> @Laruence >> http://www.laruence.com/ >> --=20 Xinchen Hui @Laruence http://www.laruence.com/