I am two arrays both containning 4 keyed values. They both have the same columns - how would I merge them like so:
Array 1:
Author|Download|Rating|Count
person|23 | 5 | 0
peter |45 | 4 | 0
Array 2:
Author|Download|Rating|Count
| 0 |0 | 3
| 0 |0 | 5
Becomes a single array:
Author|Download|Rating|Count
person|23 | 5 | 3
peter |45 | 4 | 5
This is done via two SQL Queries like shown:
Array 1
while ($stmt->fetch())
{
$array = array (
'Author' => $author,
'Download' => $download,
'Rating' => $rating,
'Count' => '',
);
}
Array 2
while ($stmt->fetch())
{
$array = array (
'Author' => '',
'Download' => '',
'Rating' => '',
'Count' => $count,
);
}
How would I get these into a single Array? I know one could do this via loop but is there an easier way to do this?