so i have two arrays. one of them looks like this (values ββor the number of elements may vary):
array('4dec' , 'def3', 'a3d6', 'd12f');
and the other:
array(array('id' => 'd12f', 'name' => 'John'),
array('id' => 'a5f1', 'name' => 'Kathy'),
array('id' => 'def3', 'name' => 'Jane'),
array('id' => 'a3d6', 'name' => 'Amy'),
array('id' => '4dec', 'name' => 'Mary'),
array('id' => 'ecc2', 'name' => 'Fred'));
(this should not change, elements and values ββare the same every time).
notice that the first has several elements from the second. How can I sort the second array based on the elements from the first?
so basically, in this case the 2nd array should become:
array(array('id' => '4dec', 'name' => 'Mary'),
array('id' => 'def3', 'name' => 'Jane'),
array('id' => 'a3d6', 'name' => 'Amy'),
array('id' => 'd12f', 'name' => 'John'),
array('id' => 'a5f1', 'name' => 'Kathy'),
array('id' => 'ecc2', 'name' => 'Fred'));
(the elements that exist in the 1st move above, in the same order as the 1st, and the rest are left alone).