$array = ['Слово 1', 'Слово 2', 'Слово 3', 'Слово 4'];
$array = ['Слово 1', 'Слово 2', 'Слово 3', 'Слово 4'];
foreach ($array as $first):
foreach ($array as $second) :
if ($first !== $second):
echo $first." ".$second."\n";
endif;
endforeach;
endforeach;