On Tue, Jun 21, 2011 at 12:55 PM, Derick Rethans <[email protected]> wrote:
> On Mon, 20 Jun 2011, Stas Malyshev wrote:
>
>> > Here is the next one.
>> >
>> > I think it's quite intuitive to use strtr() to remove single characters of
>> > a
>> > string, too, instead of using many str_replace($str, $chr, ""). I'd glad to
>> > see this change also in 5.4.
>>
>> This is a BC break, if I understand it correctly, so I don't think it is a
>> good idea.
>
> I agree that this is not a good thing then.
Right now strtr('anything', 'anything', '') === 'anything', which
means that anyone relying on this behavior is doing something strange
and dumb imo, doing a function call for nothing. We could maybe say
that strtr('anything', 'anything', null) maps all letters to an empty
string? That should take care of the user-based inputs for BC reasons,
while still allowing strtr() to be used for this "strip letter x and
y" use case.
Anyway I'm not gonna fight one way or the other, it's a detail, but I
don't think the BC concern is as big as it's presented.
Cheers
--
Jordi Boggiano
@seldaek :: http://seld.be/
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php