Skip to content
Advertisement

Automatically insert Line break?

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:

New news article

Features
- 1
- 2
- 3

it would add this to the news database:

New news article<br/>
<br/>
Features<br/>
- 1<br/>
- 2<br/>
- 3<br/>

Is there a way to do this?

Advertisement

Answer

nl2br($article)

http://www.php.net/nl2br

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement