[PHP-NOTES] note 130611 added to function.str-replace

[email protected] ("[email protected]") Thu, 15 Jan 2026 21:18:07 +0000
Newsgroups php.notes
Message-ID <[email protected]>
if you do this
$str="\a\b\c\e\t\n\r";
$temp=str_replace('\\','/',$str);

you will not get what you expect. because $str was create with " it treats the \t \n \r as escaped chrs.

$str='\a\b\c\e\t\n\r';
$temp=str_replace('\\','/',$str);
will work. I discovered this in the windows version.

for example:
$str="c:\newfolder\temp"
$temp=str_replace('\\','/',$str);
returns 
c:
e/foler	emp

not c:/newfolder/temp
----
Server IP: 206.189.2.9
Probable Submitter: 96.39.103.242
----
Manual Page -- https://php.net/manual/en/function.str-replace.php
Edit        -- https://main.php.net/note/edit/130611
Del: integrated  -- https://main.php.net/note/delete/130611/integrated
Del: useless     -- https://main.php.net/note/delete/130611/useless
Del: bad code    -- https://main.php.net/note/delete/130611/bad+code
Del: spam        -- https://main.php.net/note/delete/130611/spam
Del: non-english -- https://main.php.net/note/delete/130611/non-english
Del: in docs     -- https://main.php.net/note/delete/130611/in+docs
Del: other reasons-- https://main.php.net/note/delete/130611
Reject      -- https://main.php.net/note/reject/130611
Search      -- https://main.php.net/manage/user-notes.php