In PHP I have two arrays.
One specifies the desired key order (think table column order)
$header = ['Col1', 'Col2', 'Col3']
and then another array that needs to be sorted using that order.
$data = ['Col2' => 'Im a value', 'Col1' => 'I should be first', 'Col3' => 'Im last']
Is there a generic way in PHP to sort this array, using the order specified in the header variable? I've looked at ksort, but don't see anything that would let me send a specific order.