[PHP] how can i get rid of newlines?

2003-11-28 Thread David T-G
Hi, all -- As has been discussed before, the nl2br function doesn't actually convert newlines to breaks but instead is more like nl2nlbr. That is, input like this becomes input brlike brthis instead of inputbrlikebrthis as the name would indicate. I need a true nl2br

Re: [PHP] how can i get rid of newlines?

2003-11-28 Thread Leif K-Brooks
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); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] how can i get rid of newlines?

2003-11-28 Thread Marek Kilimajer
$string = str_replace(\n, 'br', $string); David T-G wrote: Hi, all -- As has been discussed before, the nl2br function doesn't actually convert newlines to breaks but instead is more like nl2nlbr. That is, input like this becomes input brlike brthis instead of inputbrlikebrthis

Re: [PHP] how can i get rid of newlines?

2003-11-28 Thread David T-G
Marek, et al -- ...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() :-) Thanks HAND :-D

Re: [PHP] how can i get rid of newlines? [SOLVED]

2003-11-28 Thread David T-G
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

Re: [PHP] how can i get rid of newlines? [SOLVED]

2003-11-28 Thread David T-G
Hi, all -- ...and then David T-G said... % ... % 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. All I was able to find was some

Re: [PHP] how can i get rid of newlines?

2003-11-28 Thread Marek Kilimajer
David T-G wrote: Marek, et al -- ...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() :-)

Re: [PHP] how can i get rid of newlines?

2003-11-28 Thread David T-G
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,

Re: [PHP] how can i get rid of newlines?

2003-11-28 Thread Marek Kilimajer
David T-G wrote: 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... My bad, I should not aswer questions at 4:30 a.m. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:

Re: [PHP] how can i get rid of newlines?

2003-11-28 Thread David T-G
Marek -- ...and then Marek Kilimajer said... % % David T-G wrote: % % Are you sure about that? He had % % /\r\n|\n|\r ... % % My bad, I should not aswer questions at 4:30 a.m. No problem, and I'm glad you and others do, because I'm just getting started for the long night ahead! :-) But

Re: [PHP] how can i get rid of newlines?

2003-11-28 Thread David T-G
Marek, et al -- ...and then David T-G said... % % But str_replace works for you? Interesting... I mucked about with it again and got it to work as long as I used an array for $search... I must have had a typo last time. Well, yay; I can rest easy knowing that I am using the faster function.