Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:85068 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 52951 invoked from network); 16 Mar 2015 15:00:21 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Mar 2015 15:00:21 -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.54 as permitted sender) X-PHP-List-Original-Sender: xinchen.h@zend.com X-Host-Fingerprint: 209.85.215.54 mail-la0-f54.google.com Received: from [209.85.215.54] ([209.85.215.54:34380] helo=mail-la0-f54.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 43/83-34940-100F6055 for ; Mon, 16 Mar 2015 10:00:18 -0500 Received: by lagg8 with SMTP id g8so42306125lag.1 for ; Mon, 16 Mar 2015 08:00:15 -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=CnW2/XorEoQK/sM4lMIL6G/8OGibNYTe9zdRTBUxrIs=; b=TAw8tS24FH9my04YT5Kbdds+CY57F5qj8+HQy7LVK0hZ/OIAixNKqr26xylH9zhuSf Eltmp3bJdrsEL49ACrItY/ceQCfcSXiVD+8hR8ej+duD1W8/YzJ1MyyeGGRSfiBwg/eM wuSFbZvsEBz+fEBc3kvurUvmTmkQfiJRcFctYMYNJ1ZaJ4eWKoxikm4gHmqlahrjijas GzYiy+XYosdBzQTrmbOR5T/NSSs9da9zPuuNV/6Tlxuf+R4+7eDj6yuWYT5DlZbVB1h4 KMYU1HM9l9x9xQLnMIhbk/kLOIUyhRRQRYVRfs8VDvU0tb7aV5uzjZr7OIQFpbzWl6C3 likA== X-Gm-Message-State: ALoCoQlga4MhXip49ENhW+8EKT2hPY31TEOdeU/pAfCVVMw100DCl9rNx7TD02yfRpJ6n+An2/dxxpVOTJiDxOjwDyYWErBh+/bSbHeezso6EDldehOAZWwLUhNYUTVJRd1CydF8CdoQrLR0wr5k7Sq606jkNS2cmw== X-Received: by 10.152.234.108 with SMTP id ud12mr36066872lac.81.1426518014914; Mon, 16 Mar 2015 08:00:14 -0700 (PDT) Received: from mail-lb0-f175.google.com (mail-lb0-f175.google.com. [209.85.217.175]) by mx.google.com with ESMTPSA id xq2sm2233257lbb.49.2015.03.16.08.00.13 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 Mar 2015 08:00:14 -0700 (PDT) Received: by lbcds1 with SMTP id ds1so32784495lbc.3 for ; Mon, 16 Mar 2015 08:00:13 -0700 (PDT) X-Received: by 10.152.181.197 with SMTP id dy5mr56235608lac.57.1426518013291; Mon, 16 Mar 2015 08:00:13 -0700 (PDT) MIME-Version: 1.0 Received: by 10.114.82.99 with HTTP; Mon, 16 Mar 2015 07:59:52 -0700 (PDT) In-Reply-To: References: <60525DAED8264509BF14D25637CD7C1E@gmail.com> Date: Mon, 16 Mar 2015 22:59:52 +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 5:45 PM, Peter Cowburn wro= te: > 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()` that >> 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 this > 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 earlier > 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_callback = and > its discussion thread (http://php.markmail.org/thread/qwiyq5o2vwlbdczq). > thanks > > > >> Any objections? >> >> >> =E2=80=94 >> Best, >> Wei Dai >> >> --=20 Xinchen Hui @Laruence http://www.laruence.com/