[PHP] How to add a line break in PHP

Dieser Beitrag ist auch verfügbar in: German


today I’ll like to talk about the subject line breaks with PHP. I guess this article will be not very long, because it’s done with a few lines of code. :)

All you need to do is to add, at the position in the code, where you’d like to have the line break, the characters rn. That creates a line break. But careful, a line break in the source code, not in HTML. In HTML you need to use the HTML-Tag (‘

Important to mention is also that the control character for the line break (‘rn’) needs to be between quotation marks, and not – like I just did – between apostrophes. So correct is “rn”.

And here a small code sniped, which includes all:


echo "A test with a line break at the end.rn";
echo 'Another way to write it is.'."rn";

echo "A text with a HTML line break at the end.<br />"; 
echo "Ein Text mit beiden formen. <br />rn"; 
0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *

I accept the Privacy Policy