Re: [VOTE] Feature request #38685: str_[i]replace(): Add support for (string needle, array replace)
| From: | Andrey Andreev | Date: | Tue, 03 Feb 2015 11:08:59 +0000 |
| Subject: | Re: [VOTE] Feature request #38685: str_[i]replace(): Add support for (string needle, array replace) | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-81702@lists.php.net to get a copy of this message | ||
Hi,
On Mon, Feb 2, 2015 at 7:58 PM, François Laupretre <francois@tekwire.net> wrote:
>> De : Andrey Andreev [mailto:narf@devilix.net]
>>
>> I seem to have missed the new parameter (and constants) addition
>> during the discussion ... sorry to say this, but that one would
>> probably fail the RFC.
>
> Mmh... I don't like the idea of adding a parameter but several people argued that we
> needed a way to control looping behavior, as the original idea was to loop through the replace
> array.
>
> But I am still hesitating.
>
> Instead of voting on the RFC, please tell me which behavior you prefer :
>
> - an options argument to decide on the looping behavior,
> - always stopping replacements when the replace array is exhausted
> - always looping
>
> The other options are too exotic to become the default behavior.
>
Always looping, the other option is already covered by strtr().
I'd like control over the behavior too, but that just makes the API really ugly.
Cheers,
Andrey.