How to find the array values from another array?

There is an array of
array(4) {
[377091727]=>
int(1)
[497733563]=>
int(2)
[292182390]=>
int(3)
[140594439]=>
int(4)
}

and array
array(1) {
["response"]=>
 array(2) {
["count"]=>
int(108)
["items"]=>
 array(113) {
[0]=>
 array(4) {
["type"]=>
 string(7) "profile"
["uid"]=>
int(363719724)
["first_name"]=>
 string(3) "Tim"
["last_name"]=>
 string(5) "Zubov"
}
[1]=>
 array(4) {
["type"]=>
 string(7) "profile"
["uid"]=>
int(292182390)
["first_name"]=>
 string(8) "Bob"
["last_name"]=>
 string(14) "Petrov"
}
[2]=>
 array(4) {
["type"]=>
 string(7) "profile"
["uid"]=>
int(318201765)
["first_name"]=>
 string(6) "Azamat"
["last_name"]=>
 string(13) "Gilyazetdinov"
}
[3]=>
 array(4) {
["type"]=>
 string(7) "profile"
["uid"]=>
int(290122847)
["first_name"]=>
 string(8) "Ilia"
["last_name"]=>
 string(8) "guys"
}
[4]=>
 array(4) {
["type"]=>
 string(7) "profile"
["uid"]=>
int(377091727)
["first_name"]=>
 string(12) "Andrew"
["last_name"]=>
 string(14) "Hemp"
}
[5]=>
 array(4) {
["type"]=>
 string(7) "profile"
["uid"]=>
int(140594439)
["first_name"]=>
 string(12) "Andrew"
["last_name"]=>
 string(16) "Belitsky"
}
[6]=>
 array(4) {
["type"]=>
 string(7) "profile"
["uid"]=>
int(377091727)
["first_name"]=>
 string(8) "Vlad"
["last_name"]=>
 string(10) "["
}
[7]=>
 array(4) {
["type"]=>
 string(7) "profile"
["uid"]=>
int(497733563)
["first_name"]=>
 string(8) "Ivan"
["last_name"]=>
 string(16) "rush"
}
[8]=>
 array(4) {
["type"]=>
 string(7) "profile"
["uid"]=>
int(227856960)
["first_name"]=>
 string(12) "Maxim"
["last_name"]=>
 string(16) "Leontev"
}
[9]=>
 array(4) {
["type"]=>
 string(7) "profile"
["uid"]=>
int(290520411)
["first_name"]=>
 string(8) "Vlad"
["last_name"]=>
 string(14) "Picosep"
}
[10]=>
 array(4) {
["type"]=>
 string(7) "profile"
["uid"]=>
int(151993364)
["first_name"]=>
 string(12) "Maxim"
["last_name"]=>
 string(16) "Kharchenko"
}
[11]=>
 array(4) {
["type"]=>
 string(7) "profile"
["uid"]=>
int(292182390)
["first_name"]=>
 string(8) "Leh"
["last_name"]=>
 string(12) "Minayev"
}
[12]=>
 array(4) {
["type"]=>
 string(7) "profile"
["uid"]=>
int(171322495)
["first_name"]=>
 string(8) "Sasha"
["last_name"]=>
 string(20) "Saint Catherine"
}
[13]=>
 array(4) {
["type"]=>
 string(7) "profile"
["uid"]=>
int(415914759)
["first_name"]=>
 string(10) "Timur"
["last_name"]=>
 string(12) "Asimov"
}
}
}
}
}

How to remove values from the first array that aren't in the second array of "uid"
June 3rd 19 at 19:16
2 answers
June 3rd 19 at 19:18
Solution
foreach($arr2['response']['items'] as $item) {
 if(!$arr2[$item['uid']) unset($arr2[$item['uid']);
}
The name of the first array $array2
The name of the second $result

Wrote
foreach($result['response']['items'] as $item) {
if(!$array2[$item['uid']]){
unset($array2[$item['uid']]);
}
 }

Gives a bunch of errors - neoma_Christiansen15 commented on June 3rd 19 at 19:21
Wang what about index? If there is a text error it is necessary to also put!

if(!isset($arr2[$item['uid'])) - solon_Herman commented on June 3rd 19 at 19:24
,
Notice: Undefined offset: 292182390 in C:\xampp\htdocs\make_winner.php on line 46

And there are many, but the number of different - neoma_Christiansen15 commented on June 3rd 19 at 19:27
you're only one part read my reply? - solon_Herman commented on June 3rd 19 at 19:30
and Yes NOTIS not a bug - solon_Herman commented on June 3rd 19 at 19:33
,
Did also not work.
foreach($result['response']['items'] as $profile) {
 if (isset($profile['uid'])){
 if(in_array($profile['uid'], $array2)){
 $winners2[] = $profile['uid'];
}
}
 }
- neoma_Christiansen15 commented on June 3rd 19 at 19:36
All figured out. Was with an array of some garbage - neoma_Christiansen15 commented on June 3rd 19 at 19:39
June 3rd 19 at 19:20
array_intersect will cope with this task
Unable to cope - neoma_Christiansen15 commented on June 3rd 19 at 19:23

Find more questions by tags PHPArrays