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
| <?php
$array1 = array($var1, $var2, $var3, $var4, $var5, $var6, $var7, $var8, $var9, $var10);
print_r(array_count_values($array1));
?>
<br />
Nombre maximum : <?php
$max = array_count_values($array1);
echo max($max);
?>
<br />
<?php
$calcul = array("qestion1" => $var1, "qestion2" => $var2, "qestion3" => $var3, "qestion4" => $var4, "qestion5" => $var5, "qestion6" => $var6, "qestion7" => $var7, "qestion8" =>$var8, "qestion9" => $var9, "qestion10" => $var10);
arsort($calcul);
foreach ($calcul as $key => $val) {
echo "$key = $val\n";
}
?><br />
<?php
$array = array_count_values($array1);
while ($test_name = current($array)) {
if ($test_name == "$max") {
echo key($array).'<br />';
}
next($array);
}
?> |
Partager