Salut !
Tu dois implementer cela de quelle manière ?? Fichier en entrée ? Une liste ?
Voici une idée : tu stockes dans un tableau tes mots, ensuite crées un
tableau associatif (une table de hachage quoi) en incrementant un
compteur d'occurence ! Pour finir, tu n'as plus qu'a traiter les mots
dont l'occurence apparait plus d'une fois !
En gros ca donne un truc comme ca :
<?php
$tab = array();
$tab[0] = "one";
$tab[1] = "two";
$tab[2] = "three";
$tab[3] = "one";
$tab[4] = "two";
$tab[5] = "one";
$cpt = array();
foreach ($tab as $value) {
$cpt[$value]++;
}
foreach ($cpt as $key => $nbocc) {
if ($nbocc > 1) {
echo "occurence de $key = $nbocc<br>";
}
}
?>
a+
Anli.
|