title: PHP array_key_exists does not work; array is not multi-dimensional
body: <p>I have an array of all the countries in the world as such:</p>
  
  <pre><code>$countries = array(
    "GB" =&gt; "United Kingdom",
    "US" =&gt; "United States",
    "AF" =&gt; "Afghanistan",
    "AL" =&gt; "Albania",
    "DZ" =&gt; "Algeria",
    "AS" =&gt; "American Samoa",
    "AD" =&gt; "Andorra",
    "AO" =&gt; "Angola",
    "AI" =&gt; "Anguilla",
    "AQ" =&gt; "Antarctica",
    "AG" =&gt; "Antigua And Barbuda",
    "AR" =&gt; "Argentina",
    "AM" =&gt; "Armenia",
    "AW" =&gt; "Aruba",
    "AU" =&gt; "Australia",
    "AT" =&gt; "Austria",
    "AZ" =&gt; "Azerbaijan",
    "BS" =&gt; "Bahamas",
    "BH" =&gt; "Bahrain",
    "BD" =&gt; "Bangladesh",
    "BB" =&gt; "Barbados",
    "BY" =&gt; "Belarus",
    "BE" =&gt; "Belgium",
    "BZ" =&gt; "Belize",
    "BJ" =&gt; "Benin",
    "BM" =&gt; "Bermuda",
    "BT" =&gt; "Bhutan",
    "BO" =&gt; "Bolivia",
    "BA" =&gt; "Bosnia And Herzegowina",
    "BW" =&gt; "Botswana",
    "BV" =&gt; "Bouvet Island",);
  </code></pre>
  
  <p>And so on for all countries; I am 100% positive every country is listed properly.</p>
  
  <p>I have an application form which stores the result in a file stored on the server.  Currently the review page for the application is a basic text version and I am now in the process of putting it into a mock-form for my client to have a more visually appealing method of reviewing applications.</p>
  
  <p>So an array named <code>$in_data</code> stores the results that come from the file.  This array is structured as such <code>"emergency_medical_insurance" =&gt; "value_user_entered"</code>.  Each key is the name of the HTML element it came form and the value is what the user put in.</p>
  
  <p>The country select list on the form returns a two-letter code of the country. So what I am trying to do is search <code>$countries</code> with the value of <code>$in_data['country_select']</code> and then return the name of the country.</p>
  
  <p><code>echo $in_data['country_select'];</code> returns 'CA' the letter code for Canada and the test country I have entered.</p>
  
  <p><code>echo $countries['CA'];</code> returns 'Canada'</p>
  
  <pre><code>if (array_key_exists($in_data['country_select'], $countries)){ 
        echo "Country Found";
  } 
  else { echo "failed"; }
  </code></pre>
  
  <p>returns nothing.</p>
  
  <pre><code>if (array_key_exists('CA', $countries)){ 
        echo "Country Found";
  } 
  else { echo "failed"; }
  </code></pre>
  
  <p>Also returns nothing.  And when I say nothing I mean nothing, not null, not true, not false; just doesn't even run.</p>
  
  <p>My question is simple; how is the code below (taken from the offical PHP manual) which does EXACTLY the same thing my code does, working, but my code won't even return <em>anything</em>?</p>
  
  <pre><code>&lt;?php
  $search_array = array('first' =&gt; 1, 'second' =&gt; 4);
  if (array_key_exists('first', $search_array)) {
      echo "The 'first' element is in the array";
  }
  ?&gt;
  </code></pre>