PARAGRAPHS PHP | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

PARAGRAPHS PHP

Hello everyone, I am developing a PHP page, but I do not know how to display new lines, I have tried with some functions like n2lbr(),it works but do not generate valid HTML. Thank you for your time and your help.

17th May 2019, 12:11 AM
Santi Forero
Santi Forero - avatar
2 Answers
+ 3
If I understand what you're trying to do, have you tried using the HTML <br> tag? It should output a new line as it would in an HTML document Something like echo "<br>"; should work for that 🤷‍♂️
17th May 2019, 12:44 AM
Faisal
Faisal - avatar
+ 1
What I wanted to say, is that I am trying to get a text (with paragraphs) from database, but the problem is that I do: echo $text; The text displays well, but in html source code it's wrong because it isn't into <p> tag, and we are no generating valid html. So I need a way for finding linebreaks and put the text into <p> tags. For displaying the paragraphs.
18th May 2019, 7:37 PM
Santi Forero
Santi Forero - avatar