snabbt svar - sortera dina två element innan du kombinerar dem, kontrollera sedan om de redan finns i svarsuppsättningen.
$a=array("a","b","c","d");
$b=array("b","c","d","f");
$res = array();
foreach($a as $v1) {
foreach($b as $v2) {
$t = array($v1, $v2);
asort($t);
$val = implode('', $t);
if(!in_array($val, $res))
$res[] = $val;
}
}
print_r($res);