note 97643 added to function.nl2br

From: Date: Fri, 30 Apr 2010 06:13:20 +0000
Subject: note 97643 added to function.nl2br
Groups: php.notes 
Request: Send a blank email to php-notes+get-168802@lists.php.net to get a copy of this message
<?php // convert multiple new lines to p tags // with an optional class assigned to the p tags function nl2p($string, $class='') { $class_attr = ($class!='') ? ' class="'.$class.'"' : ''; return '<p'.$class_attr.'>' .preg_replace('#(<br\s*?/?>\s*?){2,}#', '</p>'."\n".'<p'.$class_attr.'>', nl2br($string, true)) .'</p>'; } ?> ---- Server IP: 203.89.181.186 Probable Submitter: 118.90.90.26 ---- Manual Page -- http://www.php.net/manual/en/function.nl2br.php Edit -- https://master.php.net/note/edit/97643 Del: integrated -- https://master.php.net/note/delete/97643/integrated Del: useless -- https://master.php.net/note/delete/97643/useless Del: bad code -- https://master.php.net/note/delete/97643/bad+code Del: spam -- https://master.php.net/note/delete/97643/spam Del: non-english -- https://master.php.net/note/delete/97643/non-english Del: in docs -- https://master.php.net/note/delete/97643/in+docs Del: other reasons-- https://master.php.net/note/delete/97643 Reject -- https://master.php.net/note/reject/97643 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#168802) next »