Testing for the Existence of a Key in an Array
<?php
$countries = array('Germany' => 'German', 'France' => 'French', 'Spain' => 'Spanish');
$country = 'asdf';
printf("<p>%s of our visitors are from %s.</p>\n", array_key_exists($country, $countries) ? 'Some' : 'None', $country);
?>
Related examples in the same category