title: Sorting the array with Custom Key in PHP
body: <p>I have an array of one structure like below</p>
  
  <pre><code>$array1 = array(
  [123] =&gt; array('1'=&gt;'1','2'=&gt;'3'),
  [345] =&gt; array('1'=&gt;'3','2'=&gt;'5'),
  [789] =&gt; array('1'=&gt;'1','2'=&gt;'5'),
  [567] =&gt; array('1'=&gt;'6','2'=&gt;'5'),
  );
  </code></pre>
  
  <p>and another array structure as <code>$array2 = array(567,345,789,123);</code></p>
  
  <p>Now i want to sort this one with php sort function, i mean sort the first array with second one to looks like the desired output something like
  below</p>
  
  <pre><code>$array1 = array(
  [567] =&gt; array('1'=&gt;'6','2'=&gt;'5'),
  [345] =&gt; array('1'=&gt;'3','2'=&gt;'5'),
  [789] =&gt; array('1'=&gt;'1','2'=&gt;'5'),
  [123] =&gt; array('1'=&gt;'1','2'=&gt;'3'),
  );
  </code></pre>
  
  <p>I want to get these desired result with any sorting function which is already exists.</p>
  
  <p>Thanks.</p>