Re: how can i get rid of newlines?

From: Date: Sat, 29 Nov 2003 03:39:31 +0000
Subject: Re: how can i get rid of newlines?
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-171316@lists.php.net to get a copy of this message
Marek -- ..and then Marek Kilimajer said... % % David T-G wrote: % > % >...and then Marek Kilimajer said... % >% % >% $string = str_replace("\n", '<br>', $string); % > % >That didn't work for me. Interestingly enough, in light of Leif's post, % >neither did \r\n in the search pattern. Hmmph. Well, thank heavens once % >again for preg_replace() :-) .. % % Right, I did not think about dos (\r\n) newlines. But Leif's code does Neither did I; after all, nothing in my loop is running DOS! % not consider mac newlines (\r) :-). This takes care of all: Are you sure about that? He had "/\r\n|\n|\r" which, once I close the search delimiter, certainly should capture a mac end-of-line... % % $string = str_replace(array("\r\n","\n","\r"), '<br>', $string); Hmmm... I didn't try it as an array, but str_replace() failed for me with both "\n" and "\r\n"... 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!

« previous php.general (#171316) next »