Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:53497 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 15546 invoked from network); 22 Jun 2011 00:14:11 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 22 Jun 2011 00:14:11 -0000 Authentication-Results: pb1.pair.com header.from=j.boggiano@seld.be; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=j.boggiano@seld.be; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain seld.be designates 209.85.214.42 as permitted sender) X-PHP-List-Original-Sender: j.boggiano@seld.be X-Host-Fingerprint: 209.85.214.42 mail-bw0-f42.google.com Received: from [209.85.214.42] ([209.85.214.42:40298] helo=mail-bw0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id BD/B1-25945-2D3310E4 for ; Tue, 21 Jun 2011 20:14:11 -0400 Received: by bwz18 with SMTP id 18so370832bwz.29 for ; Tue, 21 Jun 2011 17:14:06 -0700 (PDT) MIME-Version: 1.0 Received: by 10.204.19.18 with SMTP id y18mr13625bka.179.1308701646560; Tue, 21 Jun 2011 17:14:06 -0700 (PDT) Received: by 10.204.113.70 with HTTP; Tue, 21 Jun 2011 17:14:06 -0700 (PDT) In-Reply-To: References: <4DFF7C28.30100@sugarcrm.com> Date: Wed, 22 Jun 2011 02:14:06 +0200 Message-ID: To: Derick Rethans Cc: Stas Malyshev , Robert Eisele , "internals@lists.php.net" Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [PHP-DEV] Changed behaviour for strtr() From: j.boggiano@seld.be (Jordi Boggiano) On Tue, Jun 21, 2011 at 12:55 PM, Derick Rethans 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/