I have two associative arrays
$reference = array(
'type_drink' => 'value',
'type_plate' => 'value',
'type_fork' => 'value',
'non_type' => 'value'
);
$target = array(
'type_plate' => 'value other',
'type_drink' => 'value other'
);
What's a nice way to re-order target to match $reference order of keys and ignoring keys that are not present in $target so that the final
$target = array(
'type_drink' => 'value other',
'type_plate' => 'value other'
);
array_intersect_key($target, $reference), but then I noticed you wanted the array sorted.