Задача, склеить массивы с одинаковыми ключами
Есть массивы:
array(2) {
[0]=>
object(stdClass)#43 (5) {
["x"]=>
string(4) "2019"
["count_all_sales"]=>
int(3833)
["count_not_pay"]=>
int(813)
["count_paid"]=>
int(2760)
["count_canceled"]=>
int(260)
}
[1]=>
object(stdClass)#44 (5) {
["x"]=>
string(4) "2020"
["count_all_sales"]=>
int(8218)
["count_not_pay"]=>
int(3183)
["count_paid"]=>
int(4941)
["count_canceled"]=>
int(94)
}
}
array(1) {
[0]=>
object(stdClass)#45 (5) {
["x"]=>
string(4) "2020"
["count_all_sales"]=>
int(9)
["count_not_pay"]=>
int(9)
["count_paid"]=>
int(0)
["count_canceled"]=>
int(0)
}
}
array(2) {
[0]=>
object(stdClass)#46 (5) {
["x"]=>
string(4) "2019"
["count_all_sales"]=>
int(10)
["count_not_pay"]=>
int(10)
["count_paid"]=>
int(0)
["count_canceled"]=>
int(0)
}
[1]=>
object(stdClass)#47 (5) {
["x"]=>
string(4) "2020"
["count_all_sales"]=>
int(27)
["count_not_pay"]=>
int(27)
["count_paid"]=>
int(0)
["count_canceled"]=>
int(0)
}
}
array(1) {
[0]=>
object(stdClass)#48 (5) {
["x"]=>
string(4) "2020"
["count_all_sales"]=>
int(1736)
["count_not_pay"]=>
int(1729)
["count_paid"]=>
int(7)
["count_canceled"]=>
int(0)
}
}
При использовании array_merge_recursive
$result_orders = array_merge_recursive($result_orders_vzr, $result_tickets, $result_cards, $result_property);
выводит все массивы и не склеивает.
Как мне на выходе получить 2 массива ?
array(2) {
[0]=>
object(stdClass)#43 (5) {
["x"]=>
string(4) "2019"
["count_all_sales"]=>
int(3833)
["count_not_pay"]=>
int(813)
["count_paid"]=>
int(2760)
["count_canceled"]=>
int(260)
}
[1]=>
object(stdClass)#44 (5) {
["x"]=>
string(4) "2020"
["count_all_sales"]=>
int(8220)
["count_not_pay"]=>
int(3185)
["count_paid"]=>
int(4940)
["count_canceled"]=>
int(95)
}
}
но с общим количеством значений?