note 51524 deleted from function.nl2br by googleguy
| From: | googleguy@php.net | Date: | Thu, 13 Jun 2013 11:03:52 +0000 |
| Subject: | note 51524 deleted from function.nl2br by googleguy | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-195153@lists.php.net to get a copy of this message | ||
Note Submitter: jochem at vuilnisbak dot com
----
For people trying br2nl, but getting stuck at double newlines (or at least more then needed), try
this:
<?php
function br2nl($coffee) {
$coffee = str_replace("\r\n", "\n", $coffee); // make from windows-returns,
*nix-returns
$coffee = str_replace("<br />\n", "\n", $coffee); // to retrieve it
return $coffee;
}
?>
The first thing \r\n is replacing linebreaks made on Windows systems. I believe *nix systems only
place \n (not sure about it).
Have fun.
Jochem