The difference between \n and
in php

<br /> is a HTML line-break, whereas \n is a newline character in the source code.

In other words, <br /> will make a new line when you view the page as rendered HTML, whereas \n will make a new line when you view the source code.

Alternatively, if you’re outputting to a console rather than somewhere that will be rendered by a web browser then \n will create a newline in the console output.

Leave a Comment