Hi,
I want to compare two articles for duplicate content and highlight these words in yellow in the output of each article. The problem I am having is to compare only 3 or more word combos and ignore 1 or 2 word combos. I think I looked at every page on php.net and did every google search known to man. I am new to php and would greatly appreciate any guidance or help.
Thanks in advance,
Gary
[php]// identify 3+, 4+, 5+, etc. consecutive matching words between 2 strings
// ignore 1 & 2 consecutive matching words between 2 strings
// string#1 = the brown dog barked all day
// string#2 = the brown dog slept all day
// ‘the brown dog’ = 3 consecutive matching words between the 2 strings
// ‘all day’ = only 2 consecutive matching words between the 2 strings
// echo both strings with dulicate 3+, 4+, 5+, etc. words highlighted in yellow
// get user input
$str1 = $_POST[‘text1’];
$str2 = $_POST[‘text2’];
// explode strings into seperate words
$str1array = explode(" “, $str1);
$str2array = explode(” ", $str2);
// compare two arrays for duplicate 3+, 4+, 5+, etc. consecutive matching words
$dupwords = array_intersect($str1array, $str2array);
// echo both articles and their word count
echo '
Article #1 - ‘;
echo count_words($str1);
echo ’ words
’;
echo stripslashes($str1);
echo '
Article #2 - ‘;
echo count_words($str2);
echo ’ words
’;
echo stripslashes($str2);
echo ‘
’;[/php]