note 130611 added to function.str-replace
| From: | emarkham@wheelerandtaylor.com | Date: | Thu, 15 Jan 2026 21:18:07 +0000 |
| Subject: | note 130611 added to function.str-replace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-222500@lists.php.net to get a copy of this message | ||
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