Вы можете использовать usort()
$test = array(array("col_header" => "other_1",
"col_order" => 12,
"data" => "asdgasdgfasdg"),
array("col_header" => "other_2",
"col_order" => 10,
"data" => "dfhgsdhgsd"),
array("col_header" => "other_3",
"col_order" => 11,
"data" => "s"));
usort($test, function($a, $b)
{
if ($a["col_order"] == $b["col_order"])
return (0);
return (($a["col_order"] < $b["col_order"]) ? -1 : 1);
});
var_dump($test);
Вывод:
array (size=3)
0 =>
array (size=3)
'col_header' => string 'other_2' (length=7)
'col_order' => int 10
'data' => string 'dfhgsdhgsd' (length=10)
1 =>
array (size=3)
'col_header' => string 'other_3' (length=7)
'col_order' => int 11
'data' => string 's' (length=1)
2 =>
array (size=3)
'col_header' => string 'other_1' (length=7)
'col_order' => int 12
'data' => string 'asdgasdgfasdg' (length=13)
Но я предлагаю вам отсортировать результатынепосредственно из запроса SQL:
SELECT *
FROM yourTable
...
ORDER BY col_order ASC