$arr = Array
(
Array(
"id" => "1",
"player_name" => "Jack",
"type" => "Arcades",
"high_score"=> "10000",
"score"=> "500",
),
Array(
"id" => "1",
"player_name" => "Jack",
"type" => "Racing",
"high_score"=> "12000",
"score"=> "700",
),
Array(
"id" => "2",
"player_name" => "Steve",
"type" => "Racing",
"high_score"=> "10000",
"score"=> "400",
),
Array(
"id" => "2",
"player_name" => "Steve",
"type" => "Arcades",
"high_score"=> "12000",
"score"=> "600",
),
Array(
"id" => "2",
"player_name" => "Steve",
"type" => "Casual",
"high_score"=> "14000",
"score"=> "650",
),
Array(
"id" => "2",
"player_name" => "Steve",
"type" => "Strategy",
"high_score"=> "10000",
"score"=> "500",
),
);
预期输出:PHP组多维数组?
$arr = Array (
'1'=>
Array(
"id" => "1",
"player_name" => "Jack",
"type" => "Arcades,Racing",
"high_score"=> "12000",
"score"=> "1200",
),
'2'=>
Array(
"id" => "2",
"player_name" => "Steve",
"type" => "Racing,Arcades,Casual,Strategy",
"high_score"=> "14000",
"score"=> "2150",
),
);
我混淆有关如何使用多维到组阵列按预期输出。我的高级建议我使用多维数组,因为我尝试了很多次,但我不知道如何分组数组,请问有人能帮助我!
@nice ...但是这会给high_score为10000 ID 2是14000,但整体的短期和快速:) +1简短的回答 – user1234
高分也可以用一个条件每次迭代 – Shahrukh
感谢检查求助! –