- array_count_values: documentation ( source)
- implode: documentation ( source)
- explode: documentation ( source)
<?php
$string = 'Super this is a test this is a test';
$arr = explode(' ', $string);
$vals = array_count_values($arr);
foreach ($arr as $key => $word)
{
if ($vals[$word] > 1) {
unset($arr[$key]);
}
}
echo implode(' ', $arr);