note 56879 added to function.nl2br
| From: | swizec at swizec dot com | Date: | Sun, 18 Sep 2005 07:21:06 +0000 |
| Subject: | note 56879 added to function.nl2br | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-95351@lists.php.net to get a copy of this message | ||
I wrote this functionb ecause I had big problems with stripping linebreaks when the files were from
different platforms which gave me a lot of trouble but this seems to work almost perfectly.
<?php
function stripnuline( $str )
{
return str_replace( "\n", '', str_replace( "\r", "\n",
str_replace( "\r\n", "\n", $str ) ) );
}
?>
Ofcourse you can easily edit this so it replaces linebreaks with whatever you want.
----
Manual Page -- http://www.php.net/manual/en/function.nl2br.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+56879
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+56879&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+56879&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+56879&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+56879&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+56879&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+56879&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+56879&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+56879&report=yes
Search -- http://master.php.net/manage/user-notes.php