我是两个包含4个键控值的数组。它们都有相同的列 - 我将如何合并它们:
数组1:
Author|Download|Rating|Count
person|23 | 5 | 0
peter |45 | 4 | 0
数组2:
Author|Download|Rating|Count
| 0 |0 | 3
| 0 |0 | 5
成为一个阵列:
Author|Download|Rating|Count
person|23 | 5 | 3
peter |45 | 4 | 5
这是通过两个SQL查询完成的,如下所示:
阵列1
while ($stmt->fetch())
{
$array = array (
'Author' => $author,
'Download' => $download,
'Rating' => $rating,
'Count' => '',
);
}
数组2
while ($stmt->fetch())
{
$array = array (
'Author' => '',
'Download' => '',
'Rating' => '',
'Count' => $count,
);
}
我如何将这些变成一个数组? 我知道可以通过循环来做到这一点,但是有更简单的方法吗?