I want to delete everything \r \n \r\n, which is pretty easy, so I wrote:
\r
\n
\r\n
str_replace(array("\r","\n"),"",$text);
but I saw this line:
str_replace(array("\r","\n","\\r","\\n"),"",$text);
and I was wondering what a double backslash is \\rand \\n.
\\r
\\n
\ is an escape character, it is used to exit the next character.
\
The "\n"backslash is reset n, and the result will be a newline .
"\n"
n
"\\n" , n , , \n ().
"\\n"
. PHP > .
str_replace() ("\n" "\r"), \n \r ("\\n" "\\r" ). \n \r, , "\\n" "\\r" .
str_replace()
"\r"
"\\r"
, $text.
$text
, , .