How can I check if a key exists? If yes, then how do I get the value of this key from an array in PHP?
E.g., I have this array:
$things = array(
'AA' => 'American history',
'AB' => 'American cooking'
);
$key_to_check = 'AB';
Now, I need to check if $key_to_check exists and if it does, get a corresponding value, which in this case will be American cooking.
if(isset($things[$key_to_check])){
echo $things[$key_to_check];
}