Return to Snippet

Revision: 34648
at October 26, 2010 15:20 by jmiller


Initial Code
function nls2p($str) {
	$str = str_replace('<p></p>', '', '<p>'
        . preg_replace('#([
]\s*?[
]){2,}#', '</p><p>', $str)
        . '</p>');
	return $str;
}

Initial URL

                                

Initial Description
Turns /n to <br> and /n/n to </p><p>

Usage:
echo stripslashes(nl2br(nls2p($text)));

Initial Title
Convert new lines to paragraphs

Initial Tags
format

Initial Language
PHP