$countries = array (
0 => Country::__set_state(
array(
'name' => 'Afghanistan',
'iso' => 'AF',
'capital' => 'Kabul'
)),
1 => Country::__set_state(
array(
'name' => 'Aland Islands',
'iso' => 'AX',
'capital' => 'Mariehamn'
)),
2 => Country::__set_state(
array(
'name' => 'Albania',
'iso' => 'AL',
'capital' => 'Tirana'
))
);
$values = ['AF', 'AL'];
foreach ($values as $value) {
if (array_key_exists($value, $countries)) {
return true;
}
}
foreach ($values as $value) {
if (in_array(['iso' => $value], $countries)) {
return true;
}
}
$values = ['AF', 'AL'];
$result = array_filter(
$countries,
function($el) use ($values) {
return in_array($el['iso'], $values);
}
);