Reply to Re: Improve this algorithm?

Your name:

Reply:


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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация