title: PHP Creating an array from an array and looping through
body: <p>I have the following code:</p>
  
  <pre><code>foreach ($row as $item) {
    if (!in_array($item['login_id'], $tmp)) {
      $tmp[] = $item['brand'];
      $tmp[] = $item['login_id'];
      $tmp[] = $item['name'];
    }
  }
  </code></pre>
  
  <p>This provides the following output:</p>
  
  <pre><code>array(408) { 
   [0]=&gt; string(4) "ABC" 
   [1]=&gt; string(8) "r4ft6tg7" 
   [2]=&gt; string(8) "Aberdeen" 
   [3]=&gt; string(4) "ABC" 
   [4]=&gt; string(8) "1ws3edft" 
   [5]=&gt; string(18) "Birmingham Airport" 
   [6]=&gt; string(4) "DDD" 
   [7]=&gt; string(8) "bgt6yhnj" 
   [8]=&gt; string(27) "Birmingham City"...}
  </code></pre>
  
  <p>I am trying to then loop through this array and add them to a dropdown using the following:</p>
  
  <pre><code>$a = 0;
  $b = 1;
  $c = 2;
  
  foreach ($tmp as $value) {
      echo "&lt;option name='".$value[$a]."' 
            value='".$value[$b]."'&gt;
            ".$value[$c]."
            &lt;/option&gt;";
  $a=$a+3;
  $b=$b+3;
  $c=$c+3;
  }
  </code></pre>
  
  <p>However the output is most odd:</p>
  
  <pre><code>&lt;option name='I' value='b'&gt;i&lt;/option&gt;
  </code></pre>
  
  <p>The output I expected and need is:</p>
  
  <pre><code>&lt;option name='ABC' value='r4ft6tg7'&gt;Aberdeen&lt;/option&gt;
  </code></pre>
  
  <p>Any suggestions, feedback on where I am going wrong would be appreciated.</p>