Wait, why not execute such a simple str_replace? $ S = 'AA \ r \ nbbb ';
$ S = str_replace ("\ r \ n", "", $ s );
Echo "s = $ s ";
Die ();
If chrome is used for debugging, \ r \ n cannot be replaced and wamp5.3 is used. I cannot find the error. could you please give me some advice?
Reply to discussion (solution)
$ S = 'AA \ r \ nbbb ';
I found the problem of single quotes.
$ S = "aa \ r \ nbbb ";
But what if I have to use single quotes?
Replace with single quotes.
$ S = str_replace ('\ r \ n', "", $ s );
\ R \ n is a common character in single quotes and a line break in double quotes.
It must be escaped in single quotes.
If single quotes are required, $ s = str_replace ('\ r \ n', "", $ s) below );
Variables in single quotes are not parsed as strings, and \ r \ n has special meanings in php, so they can also be considered as variables. Therefore, single quotes and double quotation marks are different in their resolution.
You can use single quotation marks or double quotation marks.