1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
| <?php
$Machaine1 = "mot1 mot2 mot3 mot4 etc...";
$Machaine2 = "mot5 mot6 mot7 mot1 mot8 etc...";
$TabChaine1 = split(" ",$Machaine1);
$TabChaine2 = split(" ",$Machaine2);
$TabMotsCommun = null;
//print_r($TabChaine1);
//print_r($TabChaine2);
foreach($TabChaine1 as $Mot1)
{
foreach($TabChaine2 as $Mot2)
{
//echo $Mot1."|".$Mot2;
if($Mot1==$Mot2)
{
//echo "*";
$TabMotsCommun[]=$Mot1;
}
//echo "<br/>";
}
}
//print_r($TabMotsCommun);
echo "Mot(s) Commun(s)<br/>";
foreach($TabMotsCommun as $Mot)
{
echo $Mot;
echo "<br/>";
}
?> |
Partager