I have an array:
$arr = array(
'Alcatel' => '0',
'Apple' => '4542',
'LG' => '0',
'Nokia' => '0',
'Samsung' => '2760',
'Siemens' => '0',
'Sony' => '0',
);
all the keys are alphabetically ordered, but the values are not. I want to: 1- maintain associations 2- sort the array by values HIGH to LOW 3- maintain alphabetical order for zero-value entries
to get:
$arr = array(
'Apple' => '4542',
'Samsung' => '2760',
'Alcatel' => '0',
'LG' => '0',
'Nokia' => '0',
'Siemens' => '0',
'Sony' => '0',
);
now when I used arsort($arr);
I got:
$arr = array(
'Apple' => '4542',
'Samsung' => '2760',
'Siemens' => '0',
'Sony' => '0',
'Nokia' => '0',
'LG' => '0',
'Alcatel' => '0',
);
So I got goals 1 and 2 and NOT 3
Any suggestion?
Thanks.