• View our reviews on Hot Scripts
  • JS Tutorial

Recent Comments

Powered by Disqus

Back to articles

function br2nl()

I bet you know about nl2br(), when you enter text in <textarea> element and then want to display contents of it as HTML, to get same line breaks, you'll have to use nl2br function. But what i you want to do completely opposite? You have text with different <br>, <br/> <br />  tags and you want to display it in textarea with same line breaks.

Then you can use this function:

function br2nl($text) 
    return  preg_replace('/<br\s*?/??>/i', 'rn', $text);

Found it on

You may also be interested in:

Powered by

blog comments powered by Disqus