How to use nl2br in PHP
In this article I will explain how the nl2br() function can be used in PHP.
nl2br() function in PHP
The nl2br() function is used to add HTML line breaks (<br />) in front of all newline (\n) in a string.
Syntax
Parameter
- string string is required parameter. It determine check to string.
Example
The following example show to how the nl2br() function can be used in PHP.
<html>
<body>
<h3 style="color: green;">nl2br() function example in PHP</h3>
<?php
echo nl2br("Welcome to.\nC-sharpcorner.");
?>
</body>
</html>
|
Output
You may also want to read these related articles here
Ask Your Question
Got a programming related question? You may want to post your question here