Recommended:

  • phpclasses.org
  • jsclasses.org
  • jsmag.com
  • siteapps.com
  • View our reviews on Hot Scripts
  • JS Tutorial
  • scripts.com
  • securesignup.com




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:

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

Found it on http://jawaad.blogspot.com/2007/12/php-br2nl-function.html


You may also be interested in:

Powered by BlogAlike.com

blog comments powered by Disqus