Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:85110 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 62593 invoked from network); 17 Mar 2015 01:50:23 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Mar 2015 01:50:23 -0000 Authentication-Results: pb1.pair.com header.from=zxcvdavid@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=zxcvdavid@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.192.174 as permitted sender) X-PHP-List-Original-Sender: zxcvdavid@gmail.com X-Host-Fingerprint: 209.85.192.174 mail-pd0-f174.google.com Received: from [209.85.192.174] ([209.85.192.174:35976] helo=mail-pd0-f174.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id FC/60-60187-C5887055 for ; Mon, 16 Mar 2015 20:50:20 -0500 Received: by pdbcz9 with SMTP id cz9so74684772pdb.3 for ; Mon, 16 Mar 2015 18:50:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:message-id:in-reply-to:references:subject :mime-version:content-type:content-transfer-encoding :content-disposition; bh=bI/rDZnrAPJYm9XE9IwEsK8nqqjck1xQSQqG/Jenbg8=; b=sngP9tSpBBbyYk3t8v2/l7Z4z7Eb+x3vfvDHJ/INw0V7UPp40YQBZ/gC4BsBFibOsz nw+7j9wvjb9mNeCVpVasD0X88hnHYmb7rsr+gkGv47TVdw+tI00svxYHbUufP7o2+FBm Eu8qQEARTSB5ZvUdJYZcUvsXL6pomn7ASlloKGooxJirDra/GricPaUwkIck8j3jjcfS SIZahWSUuuR8NQqnL1vRVndwyXoXeFl9A7tlcmQPQ5VXsrFHB+6luu8YQkP/81xNJjs1 XskY63dsgrUqM8PJZCmnKO8MUq3prcHmWEejwL/8juH3Y9tMSkjw8B6me3nRsw2kOy6J mxgA== X-Received: by 10.70.134.102 with SMTP id pj6mr66113039pdb.95.1426557017308; Mon, 16 Mar 2015 18:50:17 -0700 (PDT) Received: from [10.0.70.17] ([207.226.142.175]) by mx.google.com with ESMTPSA id ey1sm19345695pdb.30.2015.03.16.18.50.14 (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 16 Mar 2015 18:50:16 -0700 (PDT) Date: Tue, 17 Mar 2015 09:50:12 +0800 To: Peter Cowburn Cc: Xinchen Hui , PHP Internals Message-ID: In-Reply-To: References: <60525DAED8264509BF14D25637CD7C1E@gmail.com> X-Mailer: sparrow 1.6.4 (build 1178) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Subject: =?utf-8?Q?=E5=9B=9E=E5=A4=8D=EF=BC=9A_?=[PHP-DEV] [RFC][DISCUSSION] Add preg_replace_callback_array function From: zxcvdavid@gmail.com (Wei Dai) Hi Peter: Sorry to reply late, because the G=46W, I can=E2=80=99t access *.google.c= om at home. =20 > =20 > =20 > On 16 March 2015 at 14:59, Xinchen Hui wrote: > > Hey: > > =20 > > On Mon, Mar 16, 2015 at 5:45 PM, Peter Cowburn wrote: > > > On 16 March 2015 at 01:40, Wei Dai wrote: > > > =20 > > > > Hi internals, > > > > =20 > > > > The R=46C to add a user-land function for an easy-to-use and reli= able > > > > preg=5Freplace=5Fcallback=5Farray() in PHP is up for discussion: > > > > https://wiki.php.net/rfc/preg=5Freplace=5Fcallback=5Farray > > > > =20 > > > > This proposes adding one function: =60preg=5Freplace=5Fcallback=5F= array()=60 that > > > > is the better way to Implement when there are multiple patterns n= eed to > > > > replace. > > > > =20 > > > > I would love to hear your feedback=21 :) > > > =20 > > > Could you add a paragraph or two explaining the reasons for choosin= g this > > > particular proposal=3F > > > Some examples of what I would like to read: > > > - why we can't do preg=5Freplace=5Fcallback(=24array=5Fof=5Fregexes= , > > > =24array=5Fof=5Fcallbacks, =24subject) > > =20 > > array() also could be a valid callback.. (array(=22clasname=22, =22me= thodname=22)). > > > - why not preg=5Freplace=5Fcallback(=24array=5Fof=5Fregex=5Fto=5Fca= llback=5Fpairs, > > > =24subject) > > =20 > > there are also =24limit, =24count argument could be used. > > > - why not pass the regex used to the callback, as per Laruence's ea= rlier > > > R=46C > > =20 > > bc break..(change the callback's signature) > > > =20 > > > And give a few links to historical discussions in the same sort of = area=3F > > > E.g Laruence's R=46C: https://wiki.php.net/rfc/second=5Farg=5Fto=5F= preg=5Fcallback and > > > its discussion thread (http://php.markmail.org/thread/qwiyq5o2vwlbd= czq). > > =20 > > thanks > =20 I accept, and I will be add these details in R=46C. =20 > =20 > In case my earlier message wasn't clear, I was asking for the R=46C its= elf 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 R=46C. Thanks for the suggestion. :) > > > =20 > > > =20 > > > =20 > > > > Any objections=3F > > > > =20 > > > > =20 > > > > =E2=80=94 > > > > Best, > > > > Wei Dai > > > =20 > > =20 > > =20 > > =20 > > =20 > > -- > > Xinchen Hui > > =40Laruence > > http://www.laruence.com/ > =20 =E2=80=94 =20 Wei Dai