I have an array:
$row = [
"serial_number" => "TDZL02616"
"id_machine" => "1720"
"action" => "go"
]
and I have also an multidimensional array with definition of columns and their order (column 'sequence'):
$colDef = [
[
'name' => 'serial_number',
'sequence' => 2,
'visible' => true,
],
[
'name' => 'id_machine',
'sequence' => 1,
'visible' => true,
],
[
'name' => 'action',
'sequence' => 3,
'visible' => true,
],
]
How can I easily sort the first array ($row) according the second array ($colDef) and its columns 'sequence' that I will get the result:
$row = [
"id_machine" => "1720"
"serial_number" => "TDZL02616"
"action" => "go"
]
I have no clue where to start or how to solve it.