| Question : | How do I turn newlines / returns into html breaks (<br>)? | |
| | Answer : | We sugest you use the function nl2br which has the purpose of turning \n's into <br> (a side note since version 4.0.5 it turns \n into xhtml's </br>, to be xhtml compatible, this does not break html code). To use the function look below:
$text = "This\npage\nis\ngood";
$new_text = nl2br($text);
To read more about the function click on the link below
http://www.php.net/nl2br
| | |