The first way of writing:
$content=str_replace("n","",$content);
echo $content;
The second way of writing :
str_replace("rn","",$str);
The third way of writing:
$content=preg_replace("/s/" ,"",$content);
echo $content;
Attachment:
First let’s talk about n,r,t
n Soft Enter:
In Windows Medium means a line break and returns to the beginning of the next line.
In Linux and Unix, it only means a line break, but does not return to the beginning of the next line.
r Soft space:
in Linux and unix means returning to the beginning of the current line.
In Mac OS, it means wrapping and returning to the beginning of the next line, which is equivalent to the effect of n in Windows.
t Tab (move to next column)
A few notes:
They are valid in strings represented by double quotes or delimiters, but not in strings represented by single quotes.
rn is generally used together to represent the Enter key on the keyboard (in Linux and Unix). You can also just use n (in Windows). In Mac OS, use r to represent Enter!
t represents the "TAB" key on the keyboard.
Newline symbol in file:
windows: n
linux,unix: rn
Example code: