I have an array (variable $arr) if there is the same user_id and username than sum count.
This question is only one value is same PHP- how to sum array elements with duplicate element value
I need to check if two value is same not only one
Like this If user_id and username is same than sum count.
You can see example in my code
Before
$arr = [
[
'user_id' => 120,
'username' => test1,
'count' => 2
],
[
'user_id' => 120,
'username' => test1,
'count' => 3
],
[
'user_id' => 110,
'username' => test2,
'count' => 2
]
];
After (If user_id and username is same then sum count)
$arr = [
[
'user_id' => 120,
'username' => test1,
'count' => 5
],
[
'user_id' => 110,
'username' => test2,
'count' => 2
]
];