Encontrar valores iguais no array e somar os melhores pontos dos valores iguais
Preciso encontrar todos os valores iguais do player e da key '34MB' (exemplo) e separar as 8 melhores pontuações se tiver + que 8, se não tiver + que 8 exibir os que tem e somar total_points desse player
OBS: o player 52586 está em outra key diferente '4M1' não pode somar os valores de keys diferentes, apenas das mesmas keys
Tenho essa array:
Array
(
[34MB] => Array
(
[0] => Array
(
[n_codigo_torneio] => 37
[player] => 52586
[player_points_new] => 360
[player_class_points] => 4
[player_bonus_ranking] => 36
[player_bonus_quality] => 60
[player_bonus_quantity] => 36
[club] =>
[club_points_new] => 0
[total_points] => 492
)
[1] => Array
(
[n_codigo_torneio] => 37
[player] => 52149
[player_points_new] => 180
[player_class_points] => 4
[player_bonus_ranking] => 18
[player_bonus_quality] => 0
[player_bonus_quantity] => 18
[club] =>
[club_points_new] => 0
[total_points] => 216
)
[2] => Array
(
[n_codigo_torneio] => 37
[player] => 40599
[player_points_new] => 90
[player_class_points] => 99
[player_bonus_ranking] => 9
[player_bonus_quality] => 0
[player_bonus_quantity] => 9
[club] =>
[club_points_new] => 0
[total_points] => 108
)
)
[34MB] => Array
(
[0] => Array
(
[n_codigo_torneio] => 500
[player] => 50412
[player_points_new] => 0
[player_class_points] => 0
[player_bonus_ranking] => 0
[player_bonus_quality] => 0
[player_bonus_quantity] => 0
[club] =>
[club_points_new] => 0
[total_points] => 0
)
[1] => Array
(
[n_codigo_torneio] => 500
[player] => 16347
[player_points_new] => 0
[player_class_points] => 0
[player_bonus_ranking] => 0
[player_bonus_quality] => 0
[player_bonus_quantity] => 0
[club] =>
[club_points_new] => 0
[total_points] => 0
)
[2] => Array
(
[n_codigo_torneio] => 500
[player] => 1869
[player_points_new] => 0
[player_class_points] => 0
[player_bonus_ranking] => 0
[player_bonus_quality] => 0
[player_bonus_quantity] => 0
[club] =>
[club_points_new] => 0
[total_points] => 0
)
[3] => Array
(
[n_codigo_torneio] => 500
[player] => 30762
[player_points_new] => 0
[player_class_points] => 0
[player_bonus_ranking] => 0
[player_bonus_quality] => 0
[player_bonus_quantity] => 0
[club] =>
[club_points_new] => 0
[total_points] => 0
)
[4] => Array
(
[n_codigo_torneio] => 500
[player] => 52586
[player_points_new] => 480
[player_class_points] => 0
[player_bonus_ranking] => 0
[player_bonus_quality] => 0
[player_bonus_quantity] => 0
[club] =>
[club_points_new] => 0
[total_points] => 480
)
[5] => Array
(
[n_codigo_torneio] => 500
[player] => 4678
[player_points_new] => 0
[player_class_points] => 0
[player_bonus_ranking] => 0
[player_bonus_quality] => 0
[player_bonus_quantity] => 0
[club] =>
[club_points_new] => 0
[total_points] => 0
)
)
[4M1] => Array
(
[0] => Array
(
[n_codigo_torneio] => 29
[player] => 40189
[player_points_new] => 600
[player_class_points] => 7
[player_bonus_ranking] => 0
[player_bonus_quality] => 60
[player_bonus_quantity] => 0
[club] =>
[club_points_new] => 0
[total_points] => 660
)
[1] => Array
(
[n_codigo_torneio] => 29
[player] => 37301
[player_points_new] => 135
[player_class_points] => 5
[player_bonus_ranking] => 0
[player_bonus_quality] => 0
[player_bonus_quantity] => 0
[club] =>
[club_points_new] => 0
[total_points] => 135
)
[2] => Array
(
[n_codigo_torneio] => 29
[player] => 42623
[player_points_new] => 135
[player_class_points] => 5
[player_bonus_ranking] => 0
[player_bonus_quality] => 0
[player_bonus_quantity] => 0
[club] =>
[club_points_new] => 0
[total_points] => 135
)
[3] => Array
(
[n_codigo_torneio] => 29
[player] => 46849
[player_points_new] => 67.5
[player_class_points] => 5
[player_bonus_ranking] => 0
[player_bonus_quality] => 0
[player_bonus_quantity] => 0
[club] =>
[club_points_new] => 0
[total_points] => 67.5
)
[4] => Array
(
[n_codigo_torneio] => 1
[player] => 52586
[player_points_new] => 600
[player_class_points] => 7
[player_bonus_ranking] => 0
[player_bonus_quality] => 0
[player_bonus_quantity] => 0
[club] =>
[club_points_new] => 0
[total_points] => 600
)
)
)
Não sei como fazer isso... um exemplo, o player 52586 tem que ter 972 pontos na 34MB e 600 na 4M1.Discussão (1)
Carregando comentários...