Home  >  Article  >  Backend Development  >  What impact do line breaks have on the encoding process?

What impact do line breaks have on the encoding process?

WBOY
WBOYOriginal
2016-09-29 09:32:591404browse

What impact do line breaks have on the encoding process?

As the title says, when I was looking at the psr-2 document, I found that "php files use unxi-style lf newlines".
We know,

  • windows:CRLF

  • unix:LF

  • mac:CR

Then if I use lf line break when coding under Windows, what will be the impact?
One more question, what kind of trouble will newline characters bring us? Or are there any pitfalls in coding?

Reply content:

What impact do line breaks have on the encoding process?

As the title says, when I was looking at the psr-2 document, I found that "php files use unxi-style lf newlines".
We know,

  • windows:CRLF

  • unix:LF

  • mac:CR

Then if I use lf line break when coding under Windows, what will be the impact?
One more question, what kind of trouble will newline characters bring us? Or are there any pitfalls in coding?

The newline character just marks a newline, because the usual character encodings are compatible with ASCII, and LF and CR are always 10 to 13 in ASCII, so there are no related pitfalls in the encoding.

At present, whether it is an IDE or a regular editor, basically all have line break settings. Just select the corresponding line break in the relevant settings, whether you are under Windows or Linux.

The Windows: CRLF, *nix: LF, and early macOS: CR you mentioned are just the default line breaks of the system. It does not mean that only this type of line break can be used in the corresponding system.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn