|
Posted by Stefan Rybacki on 12/08/05 12:45
Curtis wrote:
>...
> We found the following considerably more efficient,
> submitting each paragraph in turn to a series like this:
>
>
> if (strstr($text, "/"))
>
>
> $text = preg_replace("/ ETC.
>
>
> if (strstr($text, "*"))
>
>
> $text = preg_replace("/ ETC.
>
>
> if (strstr($text, "^"))
>
>
> $text = preg_replace("/ ETC.
>
> This sequence goes on for a goodly number of characters.
>...
> Suggestions?
>
Is
$text = preg_replace("/ ETC.
always the same, means if you found / you replace it with say _ and if you found * you
also replace it with _ or what do you do in the preg_replace? Do you use regular
expressions in your preg_replace? If not you can replace it with str_replace. By the way
str_replace also enables you to replace different characters with different replacements
at once. E.g.:
$text=str_replace(array('/','*','^'),array('replacement for /','replacement for
*','replacement for ^'),$text);
Regards
Stefan
> --
>
> Curtis
>
> Visit We the Thinking
> www.wethethinking.com
> An online magazine/forum
> devoted to ideas.
>
>
[Back to original message]
|