note 19310 added to function.nl2br
| From: | ognio at peruserver dot com | Date: | Fri, 22 Feb 2002 17:47:20 +0000 |
| Subject: | note 19310 added to function.nl2br | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-26942@lists.php.net to get a copy of this message | ||
My problem was this:
I wanted to get rid of newlines
and this code didn't worked for me:
$txt = ereg_replace("\n","",$);
Why?? I had no clear explanation why this was happening..
Than I read all of this page and found that this code worked:
$col_titulo = ereg_replace("(\r\n|\n|\r)", "",$col_titulo);
Ok. That's nice... But WHY my code wasn't working in the first place??
Hmm.. I was developing on WINDOWS and publishing on UNIX..
I was unloading "\r\n" and trying to replace only the "\n" part...
So this platform problems may ALWAYS arise..
Code safely, use something like the code above and take care of (\r\n|\n|\r).
Antonio
--
http://www.php.net/manual/en/function.nl2br.php
http://master.php.net/manage/user-notes.php?action=edit+19310
http://master.php.net/manage/user-notes.php?action=delete+19310
http://master.php.net/manage/user-notes.php?action=reject+19310