I want to usort an multi-dimension array by an array so that the order of id in multi-dimension array will be arranged in order the I want. Besides, my multi-dimension array will contain values that does not in the array which is one of the reason give me headache as the usort will not works as usual.
my multi-dimension array:
$sortme = Array (
  [10005] => Array //this is the id and my expected order will be (10003,10002,10005)
        (        
          [odds] => Array
            (
               [a] => Array
                   (
                     [oda] => 1.230
                     [odb] => 0.650
                   )
                )
            )
   [10002] => Array
        (        
          [odds] => Array
            (
               [a] => Array
                   (
                     [oda] => 2.0
                     [odb] => 3.0
                   )
                )
         )
   [10003] => Array
        (        
          [odds] => Array
            (
               [a] => Array
                   (
                     [oda] => 4.0
                     [odb] => 5.0
                   )
                )
         )
   [20005] => Array  //extra id
        (        
          [odds] => Array
            (
               [a] => Array
                   (
                     [oda] => 4.0
                     [odb] => 5.0
                   )
                )
         )
 )
follow by this array:
$correct = Array ( [0] => 10003 [1] => 10002 [2] => 10005)
I have tried : but this does not work on multi-dimension array as the result before and after is the same.
foreach ($sortme as $key => $value) {
    $sortmee[$key]=$key;
    $sort = function ($a, $b) use ($correct ) {
           return array_search($a, $correct ) - array_search($b, $correct );
        };
   usort($sortmee[$key], $sort);
 }
