I’m making a news posting system and I was wondering if it is possible to automatically insert a <br />
tag where ever there is a new line?
For example, if posted a news article with the following text in the text area:
JavaScript
x
New news article
Features
- 1
- 2
- 3
it would add this to the news database:
JavaScript
New news article<br/>
<br/>
Features<br/>
- 1<br/>
- 2<br/>
- 3<br/>
Is there a way to do this?
Advertisement
Answer
JavaScript
nl2br($article)