I have the following arrays:
$files = ['376840000000367020', '376840000000375036', '376840000000389001'];
$arr = [];
foreach ($files as $key => $name) {
$arr[] = $name;
}
$data = [
'376840000000367020' => '5782',
'376840000000375036' => '5783',
'376840000000389001' => '5784',
];
print_r($arr);
This returns:
Array ( [0] => 376840000000367020 [1] => 376840000000375036.... )
I want to compare 2 arrays $arr
and $data
if the $key
is found in $arr
replace value with the $data
, I'm trying get following output:
Array ( [0] => 5782 [1] => 5783 .... )
I have lots of data to compare so its not ideal to iterate over $arr
inside foreach.
How would i go about doing this?