protected function reduce($arr, $col_amnt, $col_name, $proc = 0.02) {
$ret = array();
$sum = 0;
foreach($arr as $k=>$v) {
$sum += $v[$col_amnt];
}
if($sum == 0) return $arr;
$stop_k = 0;
foreach($arr as $k=>$v) {
//if($k < $cnt) {
if( ($v[$col_amnt] / $sum) >= $proc ) {
$ret[] = $v;
$stop_k = $k;
} else {
$v[$col_name] = 'Прочее';
$v[$col_amnt] += $ret[$stop_k+1][$col_amnt];
$ret[$stop_k+1] = $v;
}
}
return $ret;
} //reduce