note 19310 deleted from function.nl2br by didou

From: Date: Wed, 22 Oct 2003 08:02:16 +0000
Subject: note 19310 deleted from function.nl2br by didou
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-59104@lists.php.net to get a copy of this message
Note Submitter: ognio@peruserver.com ---- 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

« previous php.notes (#59104) next »