[BugFest] Feature request #38685: str_[i]replace(): Add support for (string needle, array replace)
| From: | F & N Laupretre | Date: | Mon, 05 Jan 2015 17:15:00 +0000 |
| Subject: | [BugFest] Feature request #38685: str_[i]replace(): Add support for (string needle, array replace) | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-80185@lists.php.net to get a copy of this message | ||
Hi,
I just created a PR for a feature request lying around since 2006 :
https://github.com/php/php-src/pull/980
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.
As the BC break is minimal, do you think it can be merged to the PHP7 branch
or do I need to write an RFC ?
Regards,
François