Strangely, when I use \n, or nl2br(), or PHP_EOL, or anything like that, it
strips out not just line breaks, but most of the rest of the text as well. I
suspect an encoding issue at this point.

Daniel, you were right when you said that neither of my str_replace lines
had repl.acement values; that was indeed a typo when I was copying the code
over into my email.

Ashley, I've already been using strip_tags to eliminate all but <p>, <ol>,
<ul>, and <li> tags.

On Tue, Jan 11, 2011 at 11:24 AM, David Harkness

> On Tue, Jan 11, 2011 at 11:13 AM, Richard S. Crawford <
>> wrote:
>> $content = preg_replace("/[".chr(10)."|".chr(13)."]/","",$content)
> This should be
>     $content = preg_replace('/[\r\n]/','',$content)
> First, you can embed \r and \n directly in the regular expression as-is
> (not converted to chr(10) by PHP) by using single quotes. Second, you don't
> want the vertical bar inside []. That's only for ().
> David

Richard S. Crawford (

Reply via email to