Php: how to automatically add a hyperlink to a keyword php & nbsp; how to automatically add a hyperlink to a keyword currently has a keyword table with the field keyword & nbsp; the URL automatically adds the corresponding URL link in the word table when you want to see these keywords 1st times in the article. Please advise. How does php automatically add hyperlinks to keywords?
How does php automatically add hyperlinks to keywords?
There is currently a key word table with the field: keyword URL
If you want to add these keywords 1st times in the article, the corresponding URL link in the word table will be automatically added. Please advise.
Share: More
------ Solution --------------------
Mixed preg_replace (mixed pattern, mixed replacement, mixed subject [, int limit])
If limit is specified, only limit matches are replaced. if limit is omitted or its value is-1, all matches are replaced.
------ Solution --------------------
Str_replace
Preg_replace
Both functions are supported.
------ Solution --------------------
$ String = "a B c ";
$ Patterns = array ("/a/", "/B/", "/c /");
$ Replacements = array_pad (array (), count ($ patterns), "$0 ");
Print preg_replace ($ patterns, $ replacements, $ string, 1 );