I have 2 PHP arrays that I need to combine values together.
First Array
array(2) {
[0]=>
array(1) {
["id"]=>
string(1) "1"
}
[1]=>
array(1) {
["id"]=>
string(2) "40"
}
}
Second Array
array(2) {
[0]=>
string(4) "1008"
[1]=>
string(1) "4"
}
Output desired
array(2) {
[0]=>
array(1) {
["id"]=>
string(1) "1",
["count"]=>
string(1) "1008"
}
[1]=>
array(1) {
["id"]=>
string(2) "40",
["count"]=>
string(1) "4"
}
}
As you can see I need to add a new key name (count
) to my second array and combine values to my first array.
What can I do to output this array combined?