jdk said:It should remove blank lines too before removing the dupes. I haven't been able to find anything with doing it using a textbox and PHP.
Danltn said:Did this for you. Most recent post on my blog:
http://danltn.com/remove-all-duplicate-words-204/
Enjoy.![]()
peter@flexiwebhost said:Just a note, php has absolutely no knowledge that the data has come from a textbox. All it knows is that it has certain data held in a variable.
Just had a look at your example, it might be an idea for to add the ability to enable case insensitive searches as well (your current example is case sensitive)
function unique_words($data, $case_sensitive='0')
{
if ($case_sensitive==1)
{
$data = strtolower($data);
}
$data = explode(" ", str_replace("\n", " ", $data));
return array_unique($data);
}

