You are viewing a single comment's thread. Return to all comments →
PHP
function equalizeArray($arr) { $counter = []; $max = []; foreach ($arr as $el) { isset($counter[$el]) ? $counter[$el]++ : $counter[$el] = 1; if ($counter[$el] > $max['value']) { $max['value'] = $counter[$el]; $max['index'] = $el; } } unset($counter[$max['index']]); return array_sum($counter); }
Seems like cookies are disabled on this browser, please enable them to open this website
Equalize the Array
You are viewing a single comment's thread. Return to all comments →
PHP