php \r and \n same thing?

php

Solution

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 ;-)

Problem

Why have 2 functions that does the same thing? They both add a linebreak. Any diffrence between them?

Original source