nl2br() Function | Break Line in PHP

Date Published: 02/02/2021 Published By: JaiSchool

nl2br() function takes a string in its parameter. It finds \n in given string and then it breaks line whereas it finds \n in that string. See example-


$text = "HTML stands for \n Hyper Text Markup Language";
$text = nl2br($text);
echo $text;


Publish A Comment

Leave a Reply

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