Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
10
Task/Averages-Mode/PHP/averages-mode.php
Normal file
10
Task/Averages-Mode/PHP/averages-mode.php
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
function mode($arr) {
|
||||
$count = array_count_values($arr);
|
||||
$best = max($count);
|
||||
return array_keys($count, $best);
|
||||
}
|
||||
|
||||
print_r(mode(array(1, 3, 6, 6, 6, 6, 7, 7, 12, 12, 17)));
|
||||
print_r(mode(array(1, 1, 2, 4, 4)));
|
||||
?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue