I have a table in a mysql db, in which I have a field for the first name and a field for the last name of persons.
Also I have a text that is stored in another table.
It is possible that some of the names are also part of the texts.
I want to search the text for the names and build links around these names in the text before I output the text.
It is possible that the names in the text are written in different way:
How can I achieve that there is only one link around the most complete string. For example: I don't want to have a link around first name last name and within that a link around last name again.
EDIT: I tried to store all possible combinations for all names in an array. Afterwards I search for these combinations in the text. The problem I have is that I find for example "John Doe" and genarate a link, but I also find "Doe" and there is also a link generated, which results in the following: "link"John "link"Doe"/link""/link"
Thank you and best regards