我需要一些帮助。我一直在尝试解决这个问题,但我不能,所以我想做的是我试图将对象数组 blackListUser 与contactUsers 进行比较。如果有匹配,我想返回新用户的白名单,而没有后备用户,这是最后一个预期的新数组。
for($counter = 0; $counter < count($blackListUsers); $counter++) {
how i can check here
}
ContactUsers
Array
(
[0] => stdClass Object
(
[user_id] => 2
[full_name] => User B
[image] => 1582735876user-a.png
)
[1] => stdClass Object
(
[user_id] => 3
[full_name] => User C
[image] => 1582735876user-a.png
)
[2] => stdClass Object
(
[user_id] => 4
[full_name] => User D
[image] => 1582735876user-a.png
)
[3] => stdClass Object
(
[user_id] => 5
[full_name] => User E
[image] => 1582735876user-a.png
)
[4] => stdClass Object
(
[user_id] => 6
[full_name] => User F
[image] => 1582735876user-a.png
)
[5] => stdClass Object
(
[user_id] => 8
[full_name] => User G
[image] => 1582735876user-a.png
)
)
blackListUsers
Array
(
[0] => stdClass Object
(
[user_id] => 2
[full_name] => User B
[image] => 1582735876user-a.png
)
[1] => stdClass Object
(
[user_id] => 3
[full_name] => User C
[image] => 1582735876user-a.png
)
)
expected new array
Array
(
{
"user_id": "4",
"name": "User D",
"image": "1582735876user-a.png"
},
{
"user_id": "5",
"name": "User E",
"image": "1582735876user-a.png"
},
{
"user_id": "6",
"name": "User F",
"image": "1582735876user-a.png"
},
{
"user_id": "8",
"name": "User G",
"image": "1582735876user-a.png"
}
)
慕哥6287543