Quote:
Originally posted by Mark Hensler
$text=str_replace("\n\n\n", "\n\n", $text);
or
$text=preg_replace("/\n\n\n/", "\n\n", $text);
|
Ah, Mark, that second example.... I've not come across preg_replace() what's the difference between that and eregi_replace()???
Also what is the purpose of enclosing the searchstring expression inside the paired / /?
And would this trap any number of /n or do I need to add something like {1,} giving something like:
preg_replace("(\n\n\n){1,}","\n\n",$text);
Plus would that iterate once only? What if $text==
"hello"."\n\n\n\n\n\n\n\n\n\n\n\n"."good"."\n\n\n\ n\n\n\n\"."bye"
(where the newline strings could be any length)
Finally could the new string manipulation expression be added to the existing dowordwrap() function code block or would it be safer to add a completely new and separate function? Adding the code to dowordwrap() would leave me option of turn it on/off from the existing admin options.
Thanks for taking the time to look at my problem.