I have an array with IDs that looks like
array( 0 => 12 1 => 30 2 => 50 3 => 11 4 => 22 5 => 45
Assuming the array with the IDs is named $order and the array with the values is named $items:
$order
$items
$keys = array_flip($order); usort($items, function($a, $b) use($keys) { return $keys[$a['id']] - $keys[$b['id']]; });