Eléphanteau du PHP |
23 Messages
07 sept. 2007, 02:07
pas tres ingenieux mais efficace:
$a=array("1","7","4","mots","7","0","mots","texte");
$a = array_unique($a);
ou encore;
$a=array("1","7","4","mots","7","0","mots","texte");
while(list($k,$v)=each($a)) $b[$v]++;
while(list($k,$v)=each($b)) echo $k."n";
et encore
$a=array("1","7","4","mots","7","0","mots","texte");
$q = 0;
while (list($key,$val) = each($varA)) {
@$varB[$val]++; // bien mettre "@" sinon ça indique des erreurs
}
while (list($key, $val) = each ($varB)) {
$varC[$q] = $key; $q++;
}
while (list($key, $val) = each ($varC)) {
echo "[".$key."] = ".$val."<br>";
}