如何将3个数组合并为一个大数组(相同的键)

问题描述:

我有3个数组,分别称为player1,player2,得分:

I have 3 arrays called player1, player2, score:

Array ( [0] => player1 [1] => player1 [2] => player1 ) 
Array ( [0] => player2 [1] => player3 [2] => player2 ) 
Array ( [0] => 2-3 [1] => 1-3 [2] => 2-0 )

我需要加入所有这样的数组

What I need is to join all arrays like this

[0] => player1, player2, 2-3
[1] => player1, player3, 1-3
[2] => player1, player2, 2-0

我对PHP很陌生,在发布之前我使用了搜索栏。

I am pretty new to PHP and I used the search bar before posting. Please do not down vote.

请尝试以下操作:

array_unshift($array, null);
$res = call_user_func_array('array_map', $array);

echo "<pre>";
print_r($res);

编辑: [10now评论]

       $res = array_map(null, $player1, $player2, $score); 
       echo "<pre>"; 
       print_r($res);