[PHP] str_replace to replace /n with p not having desired effect.

2004-02-19 Thread Dave G
PHP Listers, I am trying to use str_replace to format text taken from a MySQL TEXT field and make it so that it is compatible with my CSS formatting. Essentially, I want to ensure that new lines are replaced with p tags with the appropriate CSS class designation. The code I have

Re: [PHP] str_replace to replace /n with p not having desired effect.

2004-02-19 Thread Adam Voigt
Single quotes don't work for the escape characters. Use double quotes around the str_replace where there is a \n. On Thu, 2004-02-19 at 10:52, Dave G wrote: PHP Listers, I am trying to use str_replace to format text taken from a MySQL TEXT field and make it so that it is compatible

Re: [PHP] str_replace to replace /n with p not having desired effect.

2004-02-19 Thread Richard Davey
Hello Dave, Thursday, February 19, 2004, 3:52:54 PM, you wrote: DG $charInfoCss = 'p class=content' . str_replace('\n', '/p\np class=content\n', $charInfo[introE]) . '/p'; Double-bag it: str_replace(\n, /p\np class=\content\\n, $charInfo[introE]) -- Best regards, Richard Davey