Hi,
I would like to compare two arrays for matching phrases. I have searched everywhere for a solution. Any suggestions would be
greatly appreciated.
The php code below produces this array…
Array ( [0] => This [1] => tool [3] => compare [4] => two [5] => articles [7] => show [8] => any [9] => duplicate [10] => content
[11] => of [14] => more [15] => word [19] => two [20] => word [21] => phrases [22] => should [23] => be [24] => ignored. )
How do I produce the following array by ignoring 1 & 2 word phrases and only counting 3 or more consecutive matching word
phrases?
Array ( [0] => compare two articles [1] => show any duplicate content of [2] => two word phrases should be ignored )
Thanks in advance,
Gary
[php]// get user input
$str1 = 'This tool will compare two articles and show any duplicate content of 3 or more word phrases. One and two word phrases
should be ignored.’;
$str2 = ‘This tool compare two articles show any duplicate content of more word. two word phrases should be ignored.’;
// explode strings into seperate words
$str1array = explode(" “, $str1);
$str2array = explode(” ", $str2);
// compare duplicate words in the two arrays
$dupwords = array_intersect($str1array, $str2array);
print_r($dupwords);[/php]