$s = ' aa\r\nbbb ';
$s =str_replace ("\ r \ n", "", $s);
echo "s= $s";
Die ();
This I use chrome, no matter how debugging, is to replace the \ r \ n, with the wamp5.3, I really can not find the wrong, please expert guidance?
Reply to discussion (solution)
$s = ' aa\r\nbbb ';
I found out it was a single quote question written
$s = "aa\r\nbbb"; it's fine.
But what if I have to use single quotes?
Replace with single quotes.
$s =str_replace (' \ r \ n ', ' ", $s);
\ r \ n is a normal character in single quotation marks and a newline in double quotation marks.
Must be escaped with single quotation marks.
If you must use single quotation marks, then the bottom $s=str_replace (' \ r \ n ', ' ", $s);
A variable in single quotes is not parsed as a string and \ r \ n is a special meaning in PHP, so it can also be treated as a variable. So the single and double quotes are different for their resolution.
You can use single quotes or double quotes both up and down.