如何删除字符串中的重复单词,而该字符串是数组的值?
例如
foreach($results as $result)
{
foreach($result as $words)
{
echo $words = str_word_count($words,0)."\n";
}
}
结果是例如
test = 1
test activity = 2
test CI to CGI = 4
Test car Pool = 3
我想要发生的是,例如删除单词“test”的其他重复项并列出所有 unqiue 单词,以便结果只会是
test = 1
activity = 1
CI = 1
to = 1
CGI = 1
car = 1
pool = 1