note 93158 deleted from function.nl2br by danbrown
| From: | danbrown@php.net | Date: | Wed, 26 Aug 2009 18:19:41 +0000 |
| Subject: | note 93158 deleted from function.nl2br by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-159906@lists.php.net to get a copy of this message | ||
Note Submitter: gmojay at gmail dot com
----
godfrank,your function should be like this, not "(\r\n)",it should be
"[\r\n]",right?
<?php
function nl2brStrict($text, $replacement = '<br />')
{
return preg_replace("([\r\n]+)", trim($replacement), $text);
}
?>