Category Archives: What are \r and \n meaning in PHP?

What are \r and \n meaning in PHP?

1.They’re escape sequences. \n is a newline and \r is a carriage return.

In Windows most text editors have a newline as \r\n and on unix it’s \n.

2.\r is the carriage return

\n is the newline

These are available in many other languages aside from PHP.

3.They’re “carriage return” and “line feed” respectively. Typically on Windows, you need both together to represent a line terminator: “\r\n” whereas on most (all?) Unix systems, “\n” is enough.