I need to sort an array by its keys based on the order of the values in another array. Simple example:
$sort_array = array( 'key1', 'key2' );
$array_that_needs_sorting = array( 'key2' => 'value2', 'key1' => 'value1' );
After sorting, the array should be:
array( 'key1' => 'value1', 'key2' => 'value2' );