title: PHP array value to variable
body: <p>I'm using the following piece of code to count the number of <code>locations</code> from a table:</p>
  
  <pre><code>$result = mysqli_query($conn,"SELECT location FROM table ORDER BY location");
  
  $aloc_list = array();
  while ($row = mysqli_fetch_array($result))
          {$aloc_list[] = $row['location'];
          }
  
  print_r(array_count_values($aloc_list));
  </code></pre>
  
  <p>Which gives me the following array:</p>
  
  <pre><code>Array
  (
      [CANADA] =&gt; 106
      [USA] =&gt; 547
      [MEXICO] =&gt; 93
      [GREAT_BRITAIN] =&gt; 111
      [EASTERN_EUROPE] =&gt; 227
      [RUSSIA] =&gt; 405
      [CHINA] =&gt; 341
      [INDIA] =&gt; 253
  )
  </code></pre>
  
  <p>I have tried to 'extract' the array values and put them in a variable but nothing seems to work:</p>
  
  <pre><code>$canada = $aloc_list[0];
  $canada = $aloc_list['CANADA'];
  $canada = $aloc_list[0]['CANADA'];
  $canada = $aloc_list[0];
  </code></pre>
  
  <p>I want to end up with a variable called <code>$canada</code> equal to 106, a variable called <code>$usa</code> equal to 547, etc.</p>
  
  <p>How do I accomplish this?</p>