Bug #52967 [Opn]: strtr array replacement difference not the same

From: Date: Fri, 01 Oct 2010 20:15:10 +0000
Subject: Bug #52967 [Opn]: strtr array replacement difference not the same
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-154815@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=52967&edit=1 ID: 52967 User updated by: wim at powerassist dot nl Reported by: wim at powerassist dot nl Summary: strtr array replacement difference not the same Status: Open Type: Bug Package: *General Issues Operating System: Win XP PHP Version: 5.3.3 Block user comment: N New Comment: added a ) to the script. <?php $d = "Hello World"; echo strtr($d," ",""); // will print: Hello World Wrong echo strtr($d,array(" "=>"")); // will print: HelloWorld Correct ?> Previous Comments: ------------------------------------------------------------------------ [2010-10-01 22:13:47] wim at powerassist dot nl Description: ------------ The following will not work. $d = "Hello World"; echo strtr($d," ",""); // will print: Hello World But when we do: echo strtr($d,array(" "=>""); // will print: HelloWorld Test script: --------------- <?php $d = "Hello World"; echo strtr($d," ",""); // will print: Hello World Wrong echo strtr($d,array(" "=>""); // will print: HelloWorld Correct ?> Expected result: ---------------- HelloWorld HelloWorld Actual result: -------------- Hello World HelloWorld ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=52967&edit=1

« previous php.bugs (#154815) next »