PHP Line End Behavior

I was wondering what this means in laypersons:

pay attention to the end of lines. PHP uses its own function to parse input, so the Mac file will not work on Unix

An example of what this means will help.

The text can be found here, http://php.net/get_meta_tags under the file name parameters.

+3
source share
3 answers

Different operating systems use different characters to indicate a carriage return or line. Take a look at this for more details.

The newline for Windows looks like this: \r\nand the new Unix line is displayed as \n.

+2

, , . . , Mac OSX Unix. Windows Mac .

, HTML (, Windows), , (, Linux LAMP), . .

+2

I just ran into a problem when the line endings of a Mac are not working. You can enable Unix line endings to work when reading a file by setting:

ini_set("auto_detect_line_endings", true);
0
source

Source: https://habr.com/ru/post/1791333/


All Articles