I need to sort some arrays wich keys are prices of products. I've used ksort
and krsort
and everything has worked as desired. The problem is when the number of the key has more than one figures, then it doesn't order propertly.
Array example:
$array = array(
'11,45' => 'product1',
'8,91' => 'product2',
'12,14' => 'product3',
'9,54' => 'product4
);
Result I got for order ascendent:
11,45 - 12,14 - 8,91 - 9,54
Result desired for order ascendent:
8,91 - 9,54 - 11,45 - 12,14