functions – PHP identify duplicate words in a text string against a list of words


I have a list of authors’ family names – about 150 names, like: Smith, Jackson, Peters, etc.

I also have a long article (string of text), which mentions the family names of three of the 150 authors that are on the list, but one of these three authors family names is mentioned twice (it is duplicate in the article’s text). So this is the main author.

I need a php function/s to compare the list of authors’ family names against the text of the article in order to identify which author’s family name is mentioned twice and output this author’s family name as a variable in order to use it another function.

I searched I lot and most similar topics gravitate towards preg_match but could not find this exact use case being solved.

Boris Smolyanov 10 months 2022-08-19T18:01:56-05:00 0 Answers 0 views 0

Leave an answer