For example, in a line of text like this...
"My favorite MTG card is Boros Swiftblade because he works so well with my Sunforger deck."
... the phrase "Boros Swiftblade" and the word "Sunforger" would be recognized from my database of card names, and would be turned into appropriate links.
Seems like a simple str_replace will do the trick, but I can't think how to deal with overlapping card names! How would I get the code to recognize the fullest possible card name ("Karplusan Forest") and NOT recognize the smaller card name ("Forest")?
Also, will I need to worry about load times slowing down? What sort of speed can I expect if I run a str_replace on around 5,000 different phrases?
Thanks!