Slight cleaning of code needed in str_replace command.

From: Date: Sat, 21 Feb 2004 06:39:38 +0000
Subject: Slight cleaning of code needed in str_replace command.
Groups: php.general 
Request: Send a blank email to php-general+get-178431@lists.php.net to get a copy of this message
PHP listers, I recently got some help here to fix a str_replace() command. The string works, and the output from the browser looks right. However, I would like to further tweak the code so that the HTML source is also a little cleaner than it is now. The code in question is this: $charInfoCss = "<p class=\"content\">" . str_replace("\n", "</p>\n<p class=\"content\">", $charInfo[introE]) . "</p>"; echo $charInfoCss . "\n"; The way this outputs to the HTML source is like this: <p class="content">blah blah blah blah </p> <p class="content">blah blah blah blah </p> <p class="content">blah blah blah blah </p> Shouldn't the syntax that I have place the new line *after* the </p> tag? I'm trying to get it to look like this: <p class="content">blah blah blah blah</p> <p class="content">blah blah blah blah</p> <p class="content">blah blah blah blah</p> Any advice would be most welcome. -- Yoroshiku! Dave G ml@autotelic.com

« previous php.general (#178431) next »