Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:80187 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 43239 invoked from network); 5 Jan 2015 17:21:01 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Jan 2015 17:21:01 -0000 Authentication-Results: pb1.pair.com header.from=ajf@ajf.me; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=ajf@ajf.me; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain ajf.me designates 192.64.116.200 as permitted sender) X-PHP-List-Original-Sender: ajf@ajf.me X-Host-Fingerprint: 192.64.116.200 imap1-2.ox.privateemail.com Received: from [192.64.116.200] ([192.64.116.200:41900] helo=imap1-2.ox.privateemail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 41/74-21693-AF7CAA45 for ; Mon, 05 Jan 2015 12:20:59 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.privateemail.com (Postfix) with ESMTP id 8A232B00058; Mon, 5 Jan 2015 12:20:55 -0500 (EST) X-Virus-Scanned: Debian amavisd-new at imap1.ox.privateemail.com Received: from mail.privateemail.com ([127.0.0.1]) by localhost (imap1.ox.privateemail.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id vvZWlFAJvZU7; Mon, 5 Jan 2015 12:20:55 -0500 (EST) Received: from oa-res-26-240.wireless.abdn.ac.uk (oa-res-26-240.wireless.abdn.ac.uk [137.50.26.240]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.privateemail.com (Postfix) with ESMTPSA id B2697B00091; Mon, 5 Jan 2015 12:20:54 -0500 (EST) Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 8.1 \(1993\)) In-Reply-To: <003e01d0290b$2387dd30$6a979790$@yahoo.fr> Date: Mon, 5 Jan 2015 17:20:52 +0000 Cc: internals@lists.php.net Content-Transfer-Encoding: quoted-printable Message-ID: References: <003e01d0290b$2387dd30$6a979790$@yahoo.fr> To: nf.laupretre@yahoo.fr X-Mailer: Apple Mail (2.1993) Subject: Re: [PHP-DEV] [BugFest] Feature request #38685: str_[i]replace(): Add support for (string needle, array replace) From: ajf@ajf.me (Andrea Faulds) Hey Fran=E7ois, > On 5 Jan 2015, at 17:15, F & N Laupretre = wrote: >=20 > I just created a PR for a feature request lying around since 2006 : >=20 > https://github.com/php/php-src/pull/980 >=20 > It adds support in str_replace() and str_ireplace() for the = combination of > (string needle, array replace). In this case, each occurrence of the = needle > is replaced with an element f the 'replace' array, looping if = count(replace) > is lower than count(needles) in subject. It is interesting for cyclic > replacements (alternating line colors, for instance). The PR includes = the > needed tests. This would have been really useful for me quite recently, I was = disappointed to see it doesn=92t already work. Please go ahead with = this! Thanks. -- Andrea Faulds http://ajf.me/