I have these arrays $arr1 and $arr2
$arr1 = array(
'tn' => 'Tunisia',
'us' => 'United States',
'fr' => 'France');
$arr2 = array(
'tn' => 'Tunisia',
'us' => 'United States',
'fr' => 'France',
'mx' => 'Mexico',
'eu' => 'Europe' );
I want to compare $arr1 with $arr2 and if the keys in $arr2 does not exist in $arr1, the keys should be deleted from $arr2. and the resulting array of $arr3 should be same as $arr1.
$arr3 = array(
'tn' => 'Tunisia',
'us' => 'United States',
'fr' => 'France');