php \r and \n same thing?
Why have 2 functions that does the same thing? They both add a linebreak.
Any diffrence betw开发者_StackOverfloween them?
This has nothing to do with PHP, and is a consequence of history :
- UNIX / Linux use
\n
for linebreaks - Mac (before OSX) used
\r
- And windows uses a combinaison of both
PHP has just kept that behavior -- so it can work with those different OSes and their files.
Also, note :
- Those are not functions : they are (special) characters
- They are not exactly the same thing :
\r
is Carriage return\n
is Newline
- and, btw, those are another consequence of history : look at their names, and think about typewriters ;-)
精彩评论