How do I display newline characters on a webpage?
One way to get them to display is to convert them to the HTML line break character
through use of the nl2br function.
So for instance if you have
$mytext = "this is my \n text \n with new line characters";
echo nl2br($mytext);
Then the resultant information sent to the web browser looks like this:
this is my
text
with new line characters
Comment on this Question and Answer >>>
ASK A QUESTION
More strings PHP Questions
How can I remove spaces from around a string value?How do I find the position of a letter in a string in PHP?
How do I make the contents of a string upper case?
How do I make the first letter of a string uppercase?
What is the usage of { } in string handling in php?
