title: Merging two different tables using arrays
body: <p>I have two tables.</p>
  
  <p>1) products : id,name,price</p>
  
  <p>2) books    : id,title,book_price</p>
  
  <p>Now I want to merge the data of these two tables and sort them by lowest price using arrays.</p>
  
  <p>How can I merge these two arrays ?</p>
  
  <p>It should be something like this:</p>
  
  <pre><code>&lt;?php
  $a1=array( 
              "id"=&gt;1,"name"=&gt;'Ram',"price"=&gt;100 ,
              "id"=&gt;2,"name"=&gt;'Keyboard',"price"=&gt;200 ,
              "id"=&gt;3,"name"=&gt;'Mouse',"price"=&gt;300 ,
              "id"=&gt;4,"name"=&gt;'LCD',"price"=&gt;400 ,
  
              );
  
  
  $a2=array( 
              "id"=&gt;1,"title"=&gt;'ABC',"book_price"=&gt;150 ,
              "id"=&gt;2,"title"=&gt;'XYZ',"book_price"=&gt;250 ,
  
              );
  
  
  print_r(array_merge($a1,$a2));
  ?&gt; 
  </code></pre>