This query relates to the same code at issue in the recent thread "To Code a Line Break":
John provided suggested code that solved the problem completely:In an effort to simplify, I tried to do the same thing using str_replace in lieu of preg_replace:PHP Code:echo "Comment of former client" . $testitable [$element] . "(file " . rtrim($testitable [$element + 1]) . "): “" . trim(preg_replace('"<br />[\x0d\x0a]*<br />[\x0d\x0a]*"', "<br />\n<br />\n“", $testitable [$element + 2])) ."” <br /><br />[For comments of other former clients, see our <a href='testimonials.php'>testimonials </a> page.]<br />"; // display accolade.
My replacement code works, almost. The "almost" is that the replacement code causes insertion of an unwanted space immediately following insertion of quotation mark in all new paragraphs.PHP Code:echo "Comment of former client" . $testitable [$element] . "(file " . $testitable [$element + 1] . "): “" . str_replace("<br />\x0d\x0a<br />", "<br />\x0d\x0a<br />“", trim($testitable [$element + 2])) . "”<br /><br />[For comments of other former clients, see our <a href='testimonials.php'>testimonials </a> page.]<br /><br />";
I am at a loss to see from where those unwanted spaces creep.
A.



Reply With Quote
Bookmarks