I need to sort a dataset in php, It has this kind of structure:
$arr['col1'][0] = '12a';
$arr['col2'][0] = '6';
$arr['col1'][1] = '05m';
$arr['col2'][1] = '7l';
and I want to do something like this SQL:
select *
from $arr
order by col1, col2
I tryed this, but does not work
$col_1 = array_column($arr, 'col1');
$col_2 = array_column($arr, 'col2');
array_multisort($col_2, $col_1, $arr);
it gives "array sizes inconsistent"
desired order is:
05m 7l
12a 6