title: Assign Two tables into php array and display the array
body: <p>How to assign two tables into a single array and then display it with foreach loop:</p>
  
  <pre><code>TABLE: 1
  
  pcode       rate
  ------------------------------
  aaa         10
  bbb          5
  ccc          4
  
  TABLE: 2
  
   pcode       sales
  ------------------------------
  aaa         250
  bbb         100
  ccc          40
  </code></pre>
  
  <p>I have tried so far as:</p>
  
  <pre><code>$final=array();
  foreach($table1 as $t1)
          $final [$t1-&gt;code][0] = $t1-&gt;rate;
  
      foreach($table2 as $t2)
          $final [$t2-&gt;code][1] = $t2-&gt;sales;
  
  
  
  
      foreach ($final as $c=&gt;$v){
          echo "$c $v[0]  $v[1]" . "\n";   \\error
      }
  </code></pre>
  
  <p>Please suggest?</p>