Chrome Extension

nl2br() function in PHP

<?php
   echo nl2br("First line.\nSecond line.\nThird Line");
?>
Best JSON Validator, JSON Tree Viewer, JSON Beautifier at same place. Check how cool is the tool
Output
First line
Second line
Third line

To replace newline \n with <br>, we use nl2br function in PHP. This will generate Html with <br> tags and will allow showing the content in newline when required.

Was this helpful?
0 Comments