ID:               37099
 Updated by:       [EMAIL PROTECTED]
 Reported By:      admin at ifyouwantblood dot de
-Status:           Open
+Status:           Bogus
 Bug Type:         Strings related
 Operating System: Linux AND windows
 PHP Version:      5.1.2
 New Comment:

The problem is that both of your arrays contain the same characters. So
the first str_replace() changes 'e' to 't' and then changes it back when
it reaches 't' in the $replace_s array.
No bug here, just a user error.


Previous Comments:
------------------------------------------------------------------------

[2006-04-16 18:35:51] admin at ifyouwantblood dot de

Description:
------------
str_replace does not replace all array values with the associated array
replace.

Reproduce code:
---------------
<?php

$string = "test";

test($string);

function test($datei)
{
        $search_s=range('a','z');
        $replace_s=range('z','a');

        $code = str_replace($search_s, $replace_s, $datei);
                echo $code."\n";
        $decode = str_replace($replace_s, $search_s, $code);
                echo $decode;
} 

?>

Expected result:
----------------
gvhg
test

Actual result:
--------------
gehg 
tvst


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=37099&edit=1

Reply via email to