Replacing keywords in text with php & mysql
Posted
by intacto
on Stack Overflow
See other posts from Stack Overflow
or by intacto
Published on 2010-04-14T09:36:46Z
Indexed on
2010/04/14
9:43 UTC
Read the original article
Hit count: 213
Hello,
I have a news site containing an archive with more than 1 million news. I created a word definitions database with about 3000 entries, consisting of word-definition pairs.
What I want to do is adding a definition next to every occurence of these words in the news. I cant make a static change as I can add a new keyword everyday, so i can make it realtime or cached.
The question is, a str_replace or a preg_replace would be very slow for searching 3 thousand keywords in a text and replacing them.
Are there any fast alternatives?
© Stack Overflow or respective owner