Re: how can i get rid of newlines? [SOLVED]
| From: | David T-G | Date: | Sat, 29 Nov 2003 03:03:55 +0000 |
| Subject: | Re: how can i get rid of newlines? [SOLVED] | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-171313@lists.php.net to get a copy of this message | ||
Leif, et al --
..and then Leif K-Brooks said...
%
% David T-G wrote:
%
% >I need a true nl2br function to get rid of newlines; I am accepting a
% >changed ini file parameter but the newline kills me.
% >
% Try:
% $text = preg_replace("/\r\n|\n|\r", '<br>', $text);
Aha! Sure enough, that did it. In fact, just
\r\n
worked for me, but as long as I'm looking for both I might as well look
for each. Who would think that input would be converted to DOS format?
This tickles the back of my mind as something that I've seen before, now
that it's shown to me again... I'm going to have to go looking now that
I know the answer to see if I can find it in the archives.
Thanks! & HAND
:-D
--
David T-G * There is too much animal courage in
(play) davidtg@justpickone.org * society and not sufficient moral courage.
(work) davidtgwork@justpickone.org -- Mary Baker Eddy, "Science and Health"
http://justpickone.org/davidtg/ Shpx gur
Pbzzhavpngvbaf Qrprapl Npg!