title: PDO duplicate values in array
body: <p>I need to get some currency ids from db, this is my code</p>
  
  <pre><code>$arr = [];
  
  $currency_codes = array("USD", "RUB");
  $currency_codes_in = implode(',', array_fill(0, count($currency_codes), '?'));
  $query = "SELECT `curr_id` FROM `dictionary_currency` WHERE `curr_code` IN (". $currency_codes_in .")";
  $stmt = $db-&gt;prepare($query); 
  foreach ($currency_codes as $k =&gt; $id) {
      $stmt-&gt;bindValue(($k+1), $id);
  }
  
  $stmt-&gt;execute();
  $currencies = $stmt-&gt;fetchAll();
  
  foreach($currencies as $currency)
  {
      foreach($currency as $key =&gt; $value)
      {
          $arr[] = $value;
      }
  }
  print_r($arr);
  exit();
  </code></pre>
  
  <p>this is <code>$currencies</code> array</p>
  
  <pre class="lang-none prettyprint-override"><code>Array
  (
      [0] =&gt; Array
          (
              [curr_id] =&gt; 643
              [0] =&gt; 643
              [curr_code] =&gt; RUB
              [1] =&gt; RUB
          )
  
      [1] =&gt; Array
          (
              [curr_id] =&gt; 840
              [0] =&gt; 840
              [curr_code] =&gt; USD
              [1] =&gt; USD
          )
  
  )
  </code></pre>
  
  <p>and this is <code>$arr</code></p>
  
  <pre class="lang-none prettyprint-override"><code>Array
  (
      [0] =&gt; 643
      [1] =&gt; 643
      [2] =&gt; 840
      [3] =&gt; 840
  )
  </code></pre>
  
  <p>I don't understand why I get duplicate values in arrays and how to prevent it?</p>