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