A small package, in fact, different platforms have different implementations. Why are you doing this? It can be a world that is diverse.
Originally UNIX and the world had to replace it with/N, but windows in order to reflect their differences. To use/r/n, the more interesting thing is that Mac with/R. So UNIX series/n. Windows series with/r/n. Mac with/R, so you can write a program on different platforms to perform a lot of trouble. Here are some common ways to remove line breaks from PHP.
The first type of notation:
Another way to do this:
Str_replace ("\ r \ n", "", $str);
The third type of notation:
About \n,\r,\t
\ n Soft return: Represents a line break in Windows and returns to the start of the next line, in Linux, Unix, but not back to the start of the next line.
\ r Soft space: in Linux, Unix represents the return to the start of the line.
Represents a newline in Mac OS and returns to the start of the next line, equivalent to the effect of \ n in Windows.
\ t jump (move to next column)
A few notes:
They are valid in a string represented by a double-or delimiter, and are not valid in a string represented by a single-argument.
\ r \ n generally used together, to indicate the key on the keyboard return (Linux,unix), you can just use \ n (windwos), in Mac OS with \ r to indicate carriage returns.
\ t represents the "tab" key on the keyboard.
Line break symbol in file: Windows: \ n. Linux,unix: \ r \ n
Supplemental Code:
<?
Php_eol is a well-defined variable, representing the PHP newline character, which varies depending on the platform, is/r/n under Windows,/n under Linux, and/R under Mac. Line-up will be as follows.
Regular Replacement:
Copyright notice: This article Bo Master original article. Blog, not reproduced without consent.
Summary of PHP methods removing newline characters (php_eol using variables)