|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #21818 strange result with strtr()
Submitted: 2003-01-22 08:53 UTC Modified: 2003-01-23 05:43 UTC
From: ldbglobe at hotmail dot com Assigned:
Status: Not a bug Package: Strings related
PHP Version: 4.2.3 OS: Mandrake 8
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: ldbglobe at hotmail dot com
New email:
PHP Version: OS:


 [2003-01-22 08:53 UTC] ldbglobe at hotmail dot com
when i execute this expression,

echo $val=strtr('1',array('"','\"'));

i obtain the following result :


infact of 1

i try to make this operation with some other number but the probl?me seems appear only with the string '1'

PS: sorry for my poor english


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2003-01-22 08:56 UTC] ldbglobe at hotmail dot com
on freeBSD I observed the same issue
 [2003-01-22 14:47 UTC]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at and the instructions on how to report
a bug at

You are not specifying the array correctly.
it should be array('#' => '\#');

Otherwise it uses numeric keys for each array element 0 for # and 1 for \#. Meaning that all 0s will be replaced with '#' and all 1s will be replaced with \#.
 [2003-01-23 05:43 UTC] ldbglobe at hotmail dot com
hu ho what a mistake
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Sun May 28 07:03:39 2023 UTC