title: Merge two sorted arrays and the resulting array should also be sorted
body: <p>Let's say you have two arrays of arrays with the same structure but different count of arrays in them: </p>
  
  <pre><code>$arr1 = array(array(1,"b"), array(2,"a"), array(5,"c"));  
  $arr2 = array(array(3,"e"));  
  </code></pre>
  
  <p>Now, the data in the $arr1 and $arr2 is sorted, and now what I would like it to merge these two arrays, so I did this:  </p>
  
  <pre><code>$res = array_merge($arr1, $arr2);  
  </code></pre>
  
  <p>And then I get an output like this:  </p>
  
  <pre><code>1-b  
  2-a
  5-c  
  3-e  
  </code></pre>
  
  <p>But, I would like to have a sorted $res also like this:  </p>
  
  <pre><code>1-b  
  2-a
  3-e  
  5-c  
  </code></pre>
  
  <p>I wonder if there's a function in PHP to do this automatically, without me having to write my own function? Or, please advise me on which is the best approach for this if I want to (later on) add sorting by the next parameter so the output would be like this  </p>
  
  <pre><code>2-a  
  1-b
  5-c  
  3-e  
  </code></pre>
  
  <p>Thank you for all your help.</p>