Problem with strtr() and translation array
| Bug #27457 | Problem with strtr() and translation array | ||||
|---|---|---|---|---|---|
| Submitted: | 2004-03-02 03:40 UTC | Modified: | 2004-03-18 05:31 UTC | ||
| From: | solace at ezmail dot ru | Assigned: | |||
| Status: | Closed | Package: | Scripting Engine problem | ||
| PHP Version: | 5CVS-2004-03-09 | OS: | * | ||
| Private report: | No | CVE-ID: | None | ||
[2004-03-02 03:40 UTC] solace at ezmail dot ru
Description:
------------
I wanted to test compatibility of my scripts with the latest php5 beta and discovered very strange results.
Well, something is wrong with strtr() function working with translation array. It worked fine with php 4.x.x.
But strtr() with strings still works.
I'm using command-line php.exe with -n switch, without php.ini or any modules.
Reproduce code:
---------------
$test = "Dot in brackets [.]\n";
$test = strtr($test, array('.' => '0'));
// doesn't work ???
$test = strtr($test, array('0' => '.'));
echo $test;
// but this works!!!
$test = strtr($test, '0', '.');
echo $test;
Expected result:
----------------
Dot in brackets [.]
Actual result:
--------------
Dot in brackets [0]
Patches
Pull Requests
History
AllCommentsChangesGit/SVN commits
[2004-03-18 05:31 UTC] derick@php.net