Answer the question
In order to leave comments, you need to log in
How to process text in php and insert links to certain words?
For example, I have the text of an article and there is an array (string => link). In the text, these lines must be wrapped with links with the condition that you cannot insert a link into a link and the line may contain text like "Different* view", that is, the phrases "Different view", "Different view", etc. also fit the template. Maybe someone has ready-made solutions or libraries for this?
Answer the question
In order to leave comments, you need to log in
So all through ob_start()->ob_get_contents() buffering and run the string through preg_replace type conversion ("!$slovo!","$arr[$slovo]",$string) before output
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question