Any way to sort the below array by the value it contains in the order field?
$line = array(
0 => array(
0 => array('order' => 3)
),
1 => array(
0 => array('order' => 1)
),
2 => array(
0 => array('order' => 2)
),
);
Required output -
$line = array(
0 => array(
0 => array('order' => 1)
),
1 => array(
0 => array('order' => 2)
),
2 => array(
0 => array('order' => 3)
),
);
tried the below code but it does not work -
uasort($line, function($a, $b) {
return $a['entity_id'] - $b['entity_id'];
});
Update - The keys in all the above arrays are not-known, just written here for an eg.