note 82898 added to function.nl2br
| From: | rphsm at hotmail dot com | Date: | Wed, 30 Apr 2008 20:56:28 +0000 |
| Subject: | note 82898 added to function.nl2br | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-138948@lists.php.net to get a copy of this message | ||
function to replace all \n\n\n\n\n\n \r\r\r\r only one <br />
function Only1br($string)
{
return preg_replace("/(\r\n)+|(\n|\r)+/", "<br />", $string);
}
$string = "this is \n\n\n a String with many \n\n\r\r returns!";
$string = Only1br($string);
//returns: this is <br /> a String with many <br /> returns!";
----
Server IP: 69.147.83.197
Probable Submitter: 201.50.60.233
----
Manual Page -- http://www.php.net/manual/en/function.nl2br.php
Edit -- https://master.php.net/note/edit/82898
Del: integrated -- https://master.php.net/note/delete/82898/integrated
Del: useless -- https://master.php.net/note/delete/82898/useless
Del: bad code -- https://master.php.net/note/delete/82898/bad+code
Del: spam -- https://master.php.net/note/delete/82898/spam
Del: non-english -- https://master.php.net/note/delete/82898/non-english
Del: in docs -- https://master.php.net/note/delete/82898/in+docs
Del: other reasons-- https://master.php.net/note/delete/82898
Reject -- https://master.php.net/note/reject/82898
Search -- https://master.php.net/manage/user-notes.php