note 38921 deleted from function.nl2br by tomsommer
| From: | tomsommer@php.net | Date: | Mon, 12 Jan 2004 17:22:32 +0000 |
| Subject: | note 38921 deleted from function.nl2br by tomsommer | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-63355@lists.php.net to get a copy of this message | ||
Note Submitter: max_moder @at@ yahoo .dot. com
----
You might want to add another line to Junkie [Matt]'s function, to avoid any possible problems
with windows-newlines (which are \r\n instead of just \n):
<?php
function nl2br($str) {
$str = preg_replace('/\r\n/i', '<br />', $str);
$str = preg_replace('/\n/i', '<br />', $str);
return $str;
}
?>