Re: [VOTE] Feature request #38685: str_[i]replace(): Add support for (string needle, array replace)
| From: | Leigh | Date: | Mon, 02 Feb 2015 17:35:14 +0000 |
| Subject: | Re: [VOTE] Feature request #38685: str_[i]replace(): Add support for (string needle, array replace) | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-81621@lists.php.net to get a copy of this message | ||
On 2 February 2015 at 17:00, François Laupretre <francois@tekwire.net> wrote:
> Hi,
>
> Opening the vote for :
>
> https://wiki.php.net/rfc/cyclic-replace
>
> This RFC 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 of the 'replace' array.
>
> Cheers
>
> François
>
I think I would much prefer a str_replace_callback to compliment
preg_replace_callback. This would make it trivial to implement a
cyclic replacement or any other scheme you desire.