In this tutorial we will learn How To Create New Line in PHP. PHP built-in nl2br() Function can be used to create a line break, this will add the <br> tag between lines and thus the next content will start from next line.
Table of Contents
PHP nl2br() Function
PHP nl2br() Function inserts the HTML line break with the help of br tag. This is done after every line with new line character (\n).
In this example nl2br() function is used to create new line and seprate the two lines.
<?php
echo nl2br("HowToCodeSchool. \nLearn PHP Here.");
?>
In above code, a line break has been added between two lines.