3v4l.org

run code in 300+ PHP versions simultaneously
<?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);

preferences:
24.43 ms | 406 KiB | 5 Q